Skip to content

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 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.”

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 printed BUILD 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).

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.

Terminal window
java -version

prints the Java on your PATH. That isn’t always the one Gradle uses. Ask Gradle:

Terminal window
./gradlew --version

On the Fabric 1.21.1 project, started from a Java 21 terminal, it printed:

Gradle 9.7.1
Launcher 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:

Terminal window
./gradlew -q javaToolchains

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
  • JAVA_HOME decides which Java the gradlew script 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.gradle decides 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.

  • 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.properties with toolchainVersion=25, so Gradle picks Java 25 for itself whichever Java started the build.
  • New mod writes the toolchain, options.release and the Gradle wrapper for the version you pick. The values per loader and version are in Set up by loader.

Checked on 3 November 2026.