Fix "Unsupported class file major version" in mods
“Unsupported class file major version 69” means a program read a Java class compiled for a newer Java than it supports. The number is the Java version plus 44: 61 is Java 17, 65 is Java 21, 69 is Java 25. In a mod build it often means Gradle is too old for the Java it runs on, such as Gradle 8.8 on Java 25. The fix is to run Gradle on the Java the project expects, or to update Gradle.
Last checked on 3 November 2026. Every error message on this page was produced that day on a real project or class, with Temurin 17, 21 and 25. The fixes for the two Gradle errors were tried on the same projects.
What does the number mean?
Section titled “What does the number mean?”Java writes a class file version into every compiled class. For Java 8 and newer it is the Java version plus 44 (JVM Specification, §4.1). A Java runtime reads classes up to its own version and refuses newer ones.
| Major version | Java | Minecraft versions that run on it |
|---|---|---|
| 52 | 8 | 1.12.2 – 1.16.5 |
| 60 | 16 | 1.17 – 1.17.1 |
| 61 | 17 | 1.18 – 1.20.4 |
| 65 | 21 | 1.20.5 – 1.21.11 |
| 69 | 25 | 26.1 and newer |
The Minecraft column comes from Mojang’s version files. More detail is in Which Java version does Minecraft modding need?.
Which error do you have?
Section titled “Which error do you have?”| Error text | What is too old | Section |
|---|---|---|
BUG! exception in phase 'semantic analysis' ... Unsupported class file major version 69 |
Gradle, for the Java it runs on | Gradle on a too-new Java |
Dependency requires at least JVM runtime version 25. This build uses a Java 21 JVM. |
The Java Gradle runs on, for a plugin | A plugin needs a newer Java |
UnsupportedClassVersionError: ... (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0 |
The Java running the code, for the jar | The game runs on an older Java |
error: release version 25 not supported |
The JDK compiling, for the --release asked |
The compiler is too old |
Gradle runs on a Java that is too new for it
Section titled “Gradle runs on a Java that is too new for it”A Forge 1.20.1 project uses Gradle 8.8. Started with JAVA_HOME set to Java 25, ./gradlew help printed:
FAILURE: Build failed with an exception.
* What went wrong:BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 69> Unsupported class file major version 69The message comes from Groovy, which Gradle uses to compile build.gradle. The Groovy in Gradle 8.8 (3.0.21) can’t
read Java 25’s classes. Gradle runs on Java 25 only from 9.1.0, and on Java 21 only from 8.5
(Gradle compatibility matrix).
Fix it one of two ways:
- Run Gradle on the Java the project was made for. The same project with
JAVA_HOMEset to Java 17 printedBUILD SUCCESSFUL in 40s. In an IDE, setting the project JDK isn’t enough. Set the Gradle JVM in its Gradle settings too. - Or update the Gradle wrapper, if the loader’s Gradle plugin supports the newer Gradle. See Gradle is too old for Java 25.
For old Forge versions the first fix is the safer one. Linen’s Forge templates pin a Gradle version per Minecraft version, from 4.9 to 9.7.1, each matched to its ForgeGradle (Set up a Forge mod lists them).
A Gradle plugin needs a newer Java than Gradle runs on
Section titled “A Gradle plugin needs a newer Java than Gradle runs on”A Fabric 1.21.1 project with Loom 1.18, with its Daemon JVM file removed and Gradle started on Java 21:
* What went wrong:A problem occurred configuring root project 'guidemod'.> Could not resolve all artifacts for configuration 'classpath'. > Could not resolve net.fabricmc:fabric-loom:1.18.4. Required by: buildscript of root project 'guidemod' > net.fabricmc.fabric-loom-remap:net.fabricmc.fabric-loom-remap.gradle.plugin:1.18-SNAPSHOT:20261010.111021-4 > Dependency requires at least JVM runtime version 25. This build uses a Java 21 JVM.
* Try:> Run this build using a Java 25 or newer JVM.The plugin was compiled for Java 25, so Gradle refuses to load it on Java 21. The mod itself still compiles for Java 21. For 26.1 and newer, Fabric says it outright: “Minecraft 26.1 requires Java 25 minimum for the Gradle JVM” (Fabric, 14 March 2026).
Fix it one of two ways:
-
Give the project Daemon JVM criteria, so Gradle picks a matching JDK for its daemon whichever Java starts it. The tested template has
gradle/gradle-daemon-jvm.propertieswith:toolchainVersion=25./gradlew updateDaemonJvm --jvm-version=25writes it (Gradle: Daemon JVM criteria). With it,./gradlew --versionfrom a Java 21 terminal showedDaemon JVM: Compatible with Java 25. -
Or set
JAVA_HOME, or the IDE’s Gradle JVM, to Java 25.
The game or a tool runs on an older Java than the jar
Section titled “The game or a tool runs on an older Java than the jar”A class compiled for Java 21, run on Java 17:
Error: LinkageError occurred while loading main class Hello java.lang.UnsupportedClassVersionError: Hello has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0In modding, this happens when a mod is compiled for a newer Java than the game runs on. For example, a mod built with
options.release = 21 fails this way when loaded into 1.20.1, which runs on Java 17. The crash report or log names your class.
Fix: compile the mod for the Java its Minecraft version runs on. In build.gradle, set the toolchain and the
release to the same number:
tasks.withType(JavaCompile).configureEach { it.options.release = 17}
java { toolchain { languageVersion = JavaLanguageVersion.of(17) }}If the mod is right and the game is wrong, check which Java the launcher profile uses. A 26.x game needs Java 25.
The compiler is older than the Java you compile for
Section titled “The compiler is older than the Java you compile for”JDK 21’s compiler, asked for --release 25:
error: release version 25 not supportedA JDK compiles for its own version and older ones only. In a Gradle build this means the toolchain JDK is older than
options.release, usually because the toolchain line was left at the old number after a version change.
Fix: set the toolchain’s languageVersion to at least the release number, and let Gradle find or download that
JDK. The setup is in Wrong Java version.
How do you see which Java each part uses?
Section titled “How do you see which Java each part uses?”| Question | Command |
|---|---|
Which Java is on my PATH? |
java -version |
| Which Java does Gradle start and run on? | ./gradlew --version (the Launcher JVM and Daemon JVM lines) |
| Which JDKs can Gradle use for toolchains? | ./gradlew -q javaToolchains |
| Which class file version is a jar? | javap -v -cp <jar> <class name>, then the major version line (65 for the Fabric 1.21.1 test mod) |
When does this happen most?
Section titled “When does this happen most?”- After changing the Minecraft version. 1.20.4 to 1.20.5 moves from Java 17 to 21, and 1.21.11 to 26.1 moves
from 21 to 25. The toolchain,
options.release, the Gradle wrapper and the loader’s plugin all have to move together. - After installing a new JDK. A new default Java can break an old project’s Gradle, as in the first error.
- When opening an old mod. A 1.12.2 Forge mod’s Gradle 5 doesn’t run on Java 17 or newer.
In Linen
Section titled “In Linen”- Linen installs the Java version each project needs, including Java 8 for old Forge.
- New mod writes the toolchain,
options.releaseand the Gradle wrapper that match the version you pick, and on Fabric and Paper the Daemon JVM file. - Linen Check (Free) reads the build along with the mod’s files, and tells you which file to change and how.
Sources
Section titled “Sources”Checked on 3 November 2026.
- Oracle: JVM Specification, Java SE 8, §4.1, Java SE 25, §4.1
- Gradle: Compatibility Matrix, Daemon JVM criteria, Toolchains
- Fabric: Fabric for Minecraft 26.1
- Mojang: version manifest (
javaVersionper version) - The errors: Temurin 17.0.19, 21.0.11 and 25.0.3; Gradle 8.8 (Forge 1.20.1) and 9.7.1 (Fabric 1.21.1)