On This Page
The error, four ways
Error: LinkageError occurred while loading main class org.springframework.boot.loader.launch.JarLauncher
java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/launch/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
A Java 11 JVM was asked to run Spring Boot 3. That's the whole diagnosis, and it's also why the error is so annoying: Spring Boot 3 requires Java 17, everyone on the team knows that, and the build still found a Java 11 somewhere.
That block is what java -jar prints for a Boot 3.2+ fat jar on Java 11 (the launcher moved to org.springframework.boot.loader.launch in 3.2; on 3.0 and 3.1 it's org/springframework/boot/loader/JarLauncher). The text format is the JDK launcher's own, which I reproduced below with OpenJDK 11.0.33. The same root cause turns up in three other costumes, depending on which tool hit the old JVM first:
# Maven itself runs on Java 11 (spring-boot-maven-plugin 3.x)
Unable to load the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' ...
org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
# Gradle runs on Java 11 (spring-boot-gradle-plugin 3.x)
No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.5 was found.
The consumer was configured to find a library for use during runtime, compatible with Java 11 ...
Incompatible because this component declares a component, compatible with Java 17 ...
# The IDE runs your main class on an old project SDK
java.lang.UnsupportedClassVersionError: com/acme/fx/FxRateApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0) ...
The Maven and Gradle lines are as users have reported them (the versions in them are theirs); I didn't have Maven Central in this lab, so those two aren't my output. The number to look at is the pair: 61.0 is Java 17 bytecode, 55.0 says the JVM is Java 11. On Java 8 the ceiling reads 52.0. If your error says 65.0, something was compiled for Java 21 and you're on the same problem one floor up. The full table lives in the Java-side article on UnsupportedClassVersionError; I'm not going to repeat it here.
Which JVM actually ran this?
The class name in the message tells you who loaded it, and that tells you which JVM to go and look at. That's the two-minute triage:
| Class in the message | The JVM that's too old | Where to look |
|---|---|---|
org/springframework/boot/loader/...JarLauncher |
the runtime running java -jar |
Dockerfile FROM, the pod image, the server's PATH |
org/springframework/boot/maven/...Mojo |
the JVM running Maven | mvn -v, JAVA_HOME in the shell or CI step |
| "No matching variant of ...spring-boot-gradle-plugin" | the Gradle daemon | ./gradlew -v, IntelliJ's Gradle JVM setting, org.gradle.java.home |
your own class, or a org/springframework/... core class |
whatever launched the app | IDE run configuration SDK, a script with a hard-coded java path |
Then ask each candidate directly:
java -version # what the shell gives you
./mvnw -v | grep -i "java version" # the JVM Maven runs in, which is not always the one above
./gradlew -v | grep -E "Launcher JVM|Daemon JVM"
docker run --rm --entrypoint java your-image:tag -version # the image you actually ship
unzip -p target/app.jar META-INF/MANIFEST.MF | grep -E "Build-Jdk-Spec|Spring-Boot-Version"
The manifest line is quietly useful. A Boot jar records the JDK that built it (Build-Jdk-Spec) and the Boot version, so you can confirm "built on 17, run on 11" from the artifact alone, without access to the machine that built it.
Break a Java 11 runtime with a Java 17 class
I couldn't pull Spring jars into this lab (no route to Maven Central), so the lab reproduces the exact mechanism with two tiny jars and labels them honestly: fx-core.jar stands in for any Spring Boot 3 jar, because Boot 3 jars are Java 17 bytecode, and the app is a fake FX-rate feed.
What I used: OpenJDK 21.0.13 to compile, OpenJDK 11.0.33 (Ubuntu 22.04, aarch64) to run.
// core/com/acme/fx/core/RateCalculator.java (compiled with --release 17, like Boot 3)
package com.acme.fx.core;
public final class RateCalculator {
public static String quote(String pair) { return pair + " mid=1.0842"; }
}
// app/com/acme/fx/FxRateApplication.java
package com.acme.fx;
public class FxRateApplication {
public static void main(String[] args) {
System.out.println("fx-rate-feed starting on Java " + System.getProperty("java.version"));
System.out.println(com.acme.fx.core.RateCalculator.quote("EURUSD")); // first touch of the Java 17 class
}
}
Build it two ways, on JDK 21:
javac --release 17 -d out/core core/com/acme/fx/core/RateCalculator.java
jar cf fx-core.jar -C out/core .
# case 1: app compiled for 17, like a normal Boot 3 project
javac --release 17 -cp fx-core.jar -d out/app17 app/com/acme/fx/FxRateApplication.java
# case 2: app compiled for 11 against the 17 library (a Boot 3 dependency in a Java 11 project)
javac -Xlint:all --release 11 -cp fx-core.jar -d out/app11 app/com/acme/fx/FxRateApplication.java
printf 'Main-Class: com.acme.fx.FxRateApplication\nClass-Path: fx-core.jar\n' > m.txt
jar cfm fx-app-17.jar m.txt -C out/app17 .
jar cfm fx-app-11.jar m.txt -C out/app11 .
javap -v -cp fx-core.jar com.acme.fx.core.RateCalculator | grep major # major version: 61
Case 2 compiled with no error and no warning, even with -Xlint:all. Hold that thought.
Now run both on Java 11:
$ java -jar fx-app-17.jar
Error: LinkageError occurred while loading main class com.acme.fx.FxRateApplication
java.lang.UnsupportedClassVersionError: com/acme/fx/FxRateApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
exit=1
$ java -jar fx-app-11.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/acme/fx/core/RateCalculator has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
...
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:527)
at com.acme.fx.FxRateApplication.main(FxRateApplication.java:5)
exit=1
(I trimmed six class-loader frames and the startup println from the second run.)
Your confirmation signal: the message names a class, and the 61.0 / 55.0 pair matches. Case 1 fails before main runs, which is what every Boot 3 fat jar does on Java 11, because JarLauncher is the first class loaded. Case 2 starts, prints, and dies on the first line that touches the Java 17 class. If the class named is one of yours and you get Unsupported class file major version instead, you're looking at the reverse problem, a tool too old for your JDK, covered in unsupported class file major version.
Teardown is deleting the folder. Nothing else was touched.
The short answer
Every Spring Boot 3 and 4 jar is compiled to Java 17 bytecode, and a JVM refuses to load any class newer than itself. Something in your chain (the IDE, Maven, Gradle, the CI runner or the base image) is still Java 11 or 8. Find that one and move it to 17 or later.
Why the JVM refuses, and why javac didn't warn you
The floor is stated plainly in the docs. The Spring Boot 3.5 system requirements say 3.5.16 needs at least Java 17 and is compatible up to and including Java 25. The 4.0 and 4.2 pages keep the Java 17 floor and raise the ceiling to Java 27. Boot 4 did not move the minimum. People expect it to, and it didn't.
The refusal itself happens in the class loader. Every .class file starts with a major version number. When defineClass reads one higher than the running JVM understands, it throws UnsupportedClassVersionError (a LinkageError) on the spot. There's no compatibility mode, nothing to switch off. Old JVMs can't know what newer bytecode might contain, so they won't guess.
Where it surfaces depends on who loads first. With java -jar, that's Spring's JarLauncher, so the error names a Spring class and never mentions your code. With Maven, the Boot plugin's mojo classes are loaded into the JVM running Maven, so the build fails at repackage or run. Gradle checks earlier and more politely: the Boot plugin publishes Gradle metadata saying it needs Java 17, so a Java 11 daemon gets "No matching variant" before any bytecode is loaded.
Now the surprise from the lab. My first assumption was that compiling against Boot 3 jars with --release 11 would fail at compile time and save me. It didn't. javac 21 read the version-61 classes happily and produced a Java 11 app with no warning. The version check belongs to the runtime, so a build on a modern JDK can ship something that only fails on the server. (The old message class file has wrong version 61.0, should be 55.0 comes from running javac on JDK 11, which is a different situation.)
The second thing I got wrong, at least on paper: the obvious fix for the Maven case looks like a Maven toolchain pointing at JDK 17. It doesn't help with RepackageMojo. A toolchain changes the JDK that compiles and tests your code; plugins still run inside Maven's own JVM, and Boot's plugin is Java 17 code. Maven itself has to run on 17.
Making every layer agree on Java 17 for Spring Boot 3
Why this works: the error disappears when every JVM that loads Boot classes is 17 or later, and stays gone when the version is declared once and checked. Fix whichever layer the table above pointed at.
Maven. Run Maven on 17+ and let the Boot parent set the bytecode level:
<properties>
<java.version>17</java.version> <!-- spring-boot-starter-parent passes this to the compiler -->
</properties>
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 # whatever path your 17 or 21 lives at
./mvnw -v
If Maven runs on JDK 11 and you've set release to 17, the compiler plugin fails with release version 17 not supported from javac. Same fix.
Gradle. The project toolchain and the daemon JVM are two settings:
java {
toolchain { languageVersion = JavaLanguageVersion.of(17) } // compiles your code
}
The daemon (which loads the Boot plugin) follows JAVA_HOME, or org.gradle.java.home in gradle.properties. In IntelliJ it's Settings → Build Tools → Gradle → Gradle JVM, which is the setting that's still on 11 more often than anything else I've seen.
IntelliJ, Eclipse, VS Code. The project SDK and the run configuration's JRE. Maven projects in IntelliJ also have a separate "JDK for importer" and runner JRE.
CI. Pin it in the job, don't inherit the runner's default:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
Docker and Kubernetes. The image's JDK is the one production uses:
# before
FROM eclipse-temurin:11-jre
# after: 17 is the floor; 21 is a fine choice for Boot 3.x and 4.x
FROM eclipse-temurin:21-jre
With Buildpacks (spring-boot:build-image or bootBuildImage), set BP_JVM_VERSION explicitly so the image doesn't drift.
The non-fixes deserve a line each. Dropping java.version to 11 doesn't work: Boot 3 jars stay Java 17 bytecode, so you only move the error from main to the first Spring class you touch (case 2 above). Downgrading to Boot 2.7 to "fix" it trades this error for a version with no free support. And mvn clean install on the same JDK changes nothing, however many times you run it.
Cost: moving the runtime to 17 or 21 is usually cheap for the app itself. What breaks is older agents and libraries that poke at JDK internals (InaccessibleObjectException, old Lombok, old bytecode tools), which is a separate set of articles.
One JDK, declared once
The setup I'd want: one number in the build file, everything else derived from it or checked against it.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>require-java-17</id>
<goals><goal>enforce</goal></goals>
<configuration>
<rules>
<requireJavaVersion><version>[17,)</version></requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
That turns "class file version 61.0" into "Detected JDK version 11 is not in the allowed range [17,)" at the start of the build, which a junior engineer can fix without reading this. Pair it with a .sdkmanrc or .java-version in the repo, the same major version in the CI job, and a Dockerfile FROM that matches. I'd rather have three files agreeing than one clever script that guesses.
If you've got several JDKs on one machine, switching between Java versions and PATH order cover how the wrong one wins.
Catching it before production does
- Fail the build early: the enforcer rule above, or a Gradle toolchain with no fallback.
- Fail the image early: a CI step that runs
docker run --rm --entrypoint java your-image -versionand greps for the major version, plus a smoke test that starts the jar in the image you ship (not a different one). - Check the artifact:
Build-Jdk-Specin the manifest should be 17 or higher, and the base image should be the same or newer.
Version notes, so the next upgrade doesn't surprise you. Spring Boot 3.0 through 3.5 and 4.0 through 4.2 all require Java 17 at minimum. The upper bound moves: 3.5.16 lists Java 25, 4.0.10 and 4.2.0 list Java 27. Running past the listed ceiling usually fails differently, in a bytecode tool rather than the JVM. The launcher class name changed in 3.2, so a script or Dockerfile that names org.springframework.boot.loader.JarLauncher directly breaks on upgrade; the 3.2 release notes cover the move and the CLASSIC loader fallback.
Scope, honestly: I checked this against the 3.5, 4.0 and 4.2 system-requirement pages, the 3.2 release notes, and a reproduction on OpenJDK 11.0.33 and 21.0.13. I didn't run a real Boot jar or the Maven and Gradle plugins on Java 11 here, so those messages come from user reports, flagged as such above.
Takeaways
61.0means Java 17 bytecode; the second number is the JVM that refused it. That JVM is your bug.- The class name tells you which JVM:
JarLauncheris the runtime, aMojois Maven, "No matching variant" is the Gradle daemon. - A Maven toolchain doesn't fix the plugin error. Maven itself must run on 17+.
- javac on a new JDK won't stop a Java 11 build against Boot 3 jars. The runtime will.
- Boot 4 kept the Java 17 floor.
Questions people ask about this
Does Spring Boot 3 work with Java 11? No. Spring Boot 3.x (and 4.x) requires Java 17 or later, because Spring Framework 6 and 7 are built for Java 17. On Java 11 you get UnsupportedClassVersionError with class file version 61.0, either from JarLauncher, from the Maven plugin, or as a Gradle "No matching variant" error.
What Java version does Spring Boot 4 need? Java 17 is still the minimum. The Spring Boot 4.0.10 and 4.2.0 docs list compatibility up to and including Java 27. Java 21 is a sensible default for new services on either 3.x or 4.x.
Why does my Spring Boot 3 app run in IntelliJ but fail in Docker? Different JVMs. IntelliJ runs it with the project SDK, while the container uses whatever JDK its base image has. Check docker run --rm --entrypoint java your-image -version and change the FROM line to a 17+ image. The wider version of this problem is in works locally, fails in Docker.
I set the Maven toolchain to 17. Why does spring-boot-maven-plugin still fail? Toolchains only change the JDK used to compile and test your code. The Boot plugin runs inside Maven's own JVM, so mvn -v has to report Java 17 or later. Set JAVA_HOME for the shell, the wrapper or the CI step.