Which Java version does Minecraft modding need?
Minecraft modding needs the JDK of the Java version your Minecraft version runs on: Java 8 for 1.12.2 – 1.16.5, Java 16 for 1.17 – 1.17.1, Java 17 for 1.18 – 1.20.4, Java 21 for 1.20.5 – 1.21.11 and Java 25 for 26.1 and newer. Your mod compiles for that Java. Gradle, the build tool, can need a newer Java than the mod. For example, Fabric’s current Loom plugin (1.18) needs Java 25 to run, even when the mod is for 1.21.1 and compiles for Java 21.
Last checked on 3 November 2026 against Mojang’s version files for all 52 releases from 1.12.2 to 26.3, Gradle’s compatibility matrix and the tested templates named below.
Which Java does each Minecraft version need?
Section titled “Which Java does each Minecraft version need?”Each version’s JSON file in Mojang’s version manifest
has a javaVersion entry that names the Java runtime for that version. We read it for every release from 1.12.2 to 26.3:
| Minecraft | First release | Java | Mojang’s runtime name | Class file version |
|---|---|---|---|---|
| 1.12.2 – 1.16.5 | 18 September 2017 (1.12.2) | 8 | jre-legacy |
52 |
| 1.17 – 1.17.1 | 8 June 2021 | 16 | java-runtime-alpha |
60 |
| 1.18 – 1.18.2 | 30 November 2021 | 17 | java-runtime-beta |
61 |
| 1.19 – 1.20.4 | 7 June 2022 | 17 | java-runtime-gamma |
61 |
| 1.20.5 – 1.21.11 | 23 April 2024 | 21 | java-runtime-delta |
65 |
| 26.1 – 26.3 | 24 March 2026 | 25 | java-runtime-epsilon |
69 |
- The change to Java 21 came in a patch release, 1.20.5. A 1.20.4 mod and a 1.20.5 mod need different Javas.
- 1.18 and 1.19 both use Java 17, under different runtime names.
- The class file version is the number Java writes into every compiled class, and the number error messages show. It is the Java version plus 44 (Java Virtual Machine Specification, §4.1). See Fix “Unsupported class file major version”.
The loaders’ and Paper’s own docs agree. Fabric: “To develop mods for Minecraft 1.21.1, you will need JDK 21.” NeoForge’s 1.21.1 docs ask for “the Java 21 Development Kit (JDK) and 64-bit Java Virtual Machine (JVM).” Paper: “Paper requires at least Java 25 to run.”
Why does a mod build use two Javas?
Section titled “Why does a mod build use two Javas?”| Which Java | What it does | Set by |
|---|---|---|
| The Java your mod compiles for | Decides the class file version of your jar. Must not be newer than the game’s Java | The toolchain in build.gradle, and options.release |
| The Java that runs Gradle | Runs Gradle and the loader’s Gradle plugin | JAVA_HOME, your IDE’s Gradle JVM setting, or gradle/gradle-daemon-jvm.properties |
They can differ. A toolchain lets Gradle on Java 25 compile a Java 21 or even a Java 8 mod (Gradle: Toolchains). This is how the tested templates are set up:
| Template (Linen’s) | Mod compiles for | Gradle | Gradle runs on |
|---|---|---|---|
| Fabric 1.21.1 (Loom 1.18) | Java 21 | 9.7.1 | Java 25 |
| NeoForge 1.21.1 (ModDevGradle 2.0.148) | Java 21 | 9.2.1 | Java 21 |
| Forge 1.20.1 (ForgeGradle 6) | Java 17 | 8.8 | Java 17 |
| Paper 26.3 (run-paper 3.1.0) | Java 25 | 9.8.1 | Java 25 |
Here is what happens with the wrong one, tried on 3 November 2026:
- Fabric 1.21.1 with Gradle forced onto Java 21:
Dependency requires at least JVM runtime version 25. This build uses a Java 21 JVM.Loom 1.18 won’t load on anything older. - Forge 1.20.1 with Gradle 8.8 on Java 25:
Unsupported class file major version 69. Gradle 8.8 can’t run on Java 25. The same project on Java 17 printedBUILD SUCCESSFUL.
For 26.1 and newer, Fabric states it directly: “Minecraft 26.1 requires Java 25 minimum for the Gradle JVM” (Fabric, 14 March 2026).
Which Gradle version supports which Java?
Section titled “Which Gradle version supports which Java?”From Gradle’s compatibility matrix:
| Java | Gradle can compile with it (toolchain) from | Gradle can run on it from |
|---|---|---|
| 8 | no minimum (“N/A” in the matrix) | 2.0 |
| 16 | 7.0 | 7.0 |
| 17 | 7.3 | 7.3 |
| 21 | 8.4 | 8.5 |
| 25 | 9.1.0 | 9.1.0 |
Gradle’s current docs (9.8.2) say “A JVM version between 17 and 27 is required to execute Gradle.” So Gradle 9 can’t run on Java 8 or 16, but it can still compile a Java 8 mod through a toolchain. Updating the wrapper is covered in Gradle is too old for Java 25.
How do you check which Java you have?
Section titled “How do you check which Java you have?”java -versionprints the Java on your PATH. That isn’t always the one Gradle uses. Ask Gradle:
./gradlew --versionOn the Fabric 1.21.1 project, started from a Java 21 terminal, it printed:
Gradle 9.7.1Launcher JVM: 21.0.11 (Eclipse Adoptium 21.0.11+10-LTS)Daemon JVM: Compatible with Java 25, any vendor, nativeImageCapable=false (from gradle/gradle-daemon-jvm.properties)The launcher started on Java 21, and the daemon that runs the build was picked to match Java 25, because the project’s
gradle/gradle-daemon-jvm.properties says toolchainVersion=25. Gradle calls these the Daemon JVM criteria. The
updateDaemonJvm task writes the file
(Gradle: Daemon JVM criteria).
To list every Java Gradle can find for toolchains:
./gradlew -q javaToolchainsWhich JDK should you install?
Section titled “Which JDK should you install?”Any 64-bit JDK of the right version works. Eclipse Temurin, from Adoptium, is one free option. Adoptium’s support page lists these long-term support releases, with the earliest date it stops building each:
| Java | First released | Temurin builds until at least |
|---|---|---|
| 8 | March 2014 | December 2030 |
| 17 | September 2021 | October 2027 |
| 21 | September 2023 | December 2029 |
| 25 | September 2025 | September 2031 |
Java 16 isn’t a long-term support release and isn’t in that table. For a 1.17 mod, Gradle can download a Java 16 toolchain through a toolchain resolver plugin, as in Wrong Java version.
Install a JDK rather than a JRE. A JRE runs Java programs but has no compiler. Several JDKs can sit side by side, and Gradle toolchains pick the one each project asks for.
What should you install for common setups?
Section titled “What should you install for common setups?”| You mod | Install |
|---|---|
| 26.x (any loader) | JDK 25 |
| 1.20.5 – 1.21.11 on Fabric with current Loom | JDK 21 and JDK 25 |
| 1.20.5 – 1.21.11 on NeoForge or Forge | JDK 21 |
| 1.18 – 1.20.4 | JDK 17; on Fabric with current Loom, also JDK 25 |
| 1.12.2 – 1.16.5 | JDK 8; a project on Gradle 9 also needs JDK 17 or newer to run Gradle |
What about JAVA_HOME and the IDE?
Section titled “What about JAVA_HOME and the IDE?”JAVA_HOMEdecides which Java thegradlewscript starts with, unless the project has Daemon JVM criteria.- IntelliJ IDEA has its own Gradle JVM setting in its Gradle settings. Fabric’s 26.1 post points there: “You can configure this in your IDE’s Gradle Settings.”
- A Gradle toolchain in
build.gradledecides only the Java your mod compiles for. It doesn’t change the Java Gradle runs on.
If a build fails with a Java error, the fixes by message are in Fix “Unsupported class file major version”, and the toolchain setup in Wrong Java version.
In Linen
Section titled “In Linen”- Linen installs the Java version a project needs, including Java 8 for old Forge.
- Linen’s Fabric and Paper templates include
gradle/gradle-daemon-jvm.propertieswithtoolchainVersion=25, so Gradle picks Java 25 for itself whichever Java started the build. - New mod writes the toolchain,
options.releaseand the Gradle wrapper for the version you pick. The values per loader and version are in Set up by loader.
Sources
Section titled “Sources”Checked on 3 November 2026.
- Mojang: version manifest and each release’s
version JSON (
javaVersion.component,javaVersion.majorVersion,releaseTime) - Oracle: JVM Specification, Java SE 8, §4.1 (“JDK release 1.k supports class file format versions in the range 45.0 through 44+k.0”) and Java SE 25, §4.1 (major versions 45 to 69)
- Gradle: Compatibility Matrix, Toolchains, Daemon JVM criteria
- Fabric: Setting up a Development Environment (1.21.1), Fabric for Minecraft 26.1
- NeoForge: Getting Started (1.21.1)
- PaperMC: Getting started
- Adoptium: Temurin support