Minecraft: Java Edition is a Java program, so every launch needs a Java runtime. Different game versions need different ones, and using the wrong one is a common cause of startup crashes that look like mod problems.
Which version needs what
| Minecraft version | Java |
|---|---|
| 1.16.5 and older | Java 8 |
| 1.17 – 1.20.4 | Java 17 |
| 1.20.5 and newer | Java 21 |
| Newest snapshots and releases | Java 21 or 25, depending on the version |
The launcher reads the requirement out of Mojang's version metadata rather than guessing from the version number, so a version that changes its requirement is handled correctly without an update.
The default: managed runtimes
By default the launcher downloads Mojang's own build of the Java it needs and keeps it under %APPDATA%\DonutLauncher\java. Nothing is installed system-wide, nothing appears in Add or Remove Programs, and no environment variable is touched. If you uninstall the launcher and delete that folder, your system is exactly as it was.
They are the ones the game is tested against, they are distributed through the same verified download path as the game, and they cannot be sabotaged by a system-wide Java upgrade you did not ask for.
Using your own Java
If you develop mods, need a specific patch level, or simply prefer your own runtime, you can point the launcher at one:
- Open Settings → Java.
- Turn off Detect automatically.
- Press Browse and select the
java.exeinside a JDK'sbinfolder. On Windows that is usuallyC:\Program Files\Java\jdk-21\bin\java.exe.
The launcher runs the binary and asks it to report its own version before accepting it. A file that is not a working Java runtime is refused with the reason, rather than accepted and then failing at launch with no explanation.
Memory and other JVM arguments
Settings → Java holds the global values; each instance can override them from Manage on its card.
- Maximum memory is the heap ceiling passed to the JVM. 4 GB suits vanilla and light modpacks; large modpacks want 6–8 GB. Going above what your machine physically has makes things worse, not better — the operating system starts swapping and a 30-second load becomes five minutes.
- JVM preset picks a set of flags for the job: a default set, a low-memory set for old hardware, and a development set with a debug port open.
- Custom arguments are appended after the preset, so they win in a conflict. That is where things like
-XX:+UseZGCgo.
Diagnosing a Java problem
Open the Logs page and press Analyse. A wrong-Java launch produces a specific shape of failure:
# Wrong Java: the class file version is newer than the runtime understands. java.lang.UnsupportedClassVersionError: net/minecraft/client/main/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognises class file versions up to 61.0
Class file version 65 is Java 21, 61 is Java 17. The analyser names the requirement for the version you launched.