Minecraft Java Edition runs on Java, and each Minecraft version expects a specific major Java version. The table below comes from the javaVersion field in Mojang’s official version manifest, checked on November 7, 2026.
| Minecraft version | Java version |
|---|---|
| 1.16.5 and older | Java 8 |
| 1.17 – 1.17.1 | Java 16 |
| 1.18 – 1.20.4 | Java 17 |
| 1.20.5 – 1.21.11 | Java 21 |
| 26.1 and newer | Java 25 |
The official launcher downloads the right Java automatically. Problems usually start with third-party launchers, manual installs or old modpacks.
Old Forge needs Java 8
Forge for 1.16.5 and older was built for Java 8. Running it on Java 9 or newer typically crashes with AppClassLoader cannot be cast to class java.net.URLClassLoader. Set those instances to Java 8.
Reading “class file version” errors
If you see UnsupportedClassVersionError with a class file version, the code needs a newer Java:
- 52.0 → Java 8
- 61.0 → Java 17
- 65.0 → Java 21
- 69.0 → Java 25
Switching Java per instance
- Official launcher: Installations → Edit → More options → Java executable.
- Prism Launcher: Edit instance → Settings → Java → Java installation.
- CurseForge app: Settings → Minecraft → Java Settings.
If you need to install Java yourself, use a trusted build such as Eclipse Temurin or Microsoft Build of OpenJDK.