Which Java version does a Minecraft server need?
Every Minecraft release needs a minimum Java version, and a server will not start on an older one. The “26.1” in newer Minecraft version numbers is the game version, not a Java version: it needs Java 25, not Java 26.
Java version by Minecraft version
| Minecraft version | Java you need |
|---|---|
| 26.1 and newer | Java 25 |
| 1.20.5 to 1.21.x | Java 21 |
| 1.18 to 1.20.4 | Java 17 |
| 1.17 | Java 16 |
| 1.12 to 1.16.5 | Java 8 |
These are the minimums listed on the Minecraft Wiki. A newer Java usually runs an older server too, but old plugins and mods sometimes break on it. For a modpack, use the Java version its author names.
Check which Java you have
Run this in the server's terminal:
java -version
The first line shows the version, for example openjdk version "21.0.5". If the command is not found, Java is not installed.
Install the right Java on Ubuntu or Debian
You only need the headless build, which has no desktop parts. For Java 21:
sudo apt update sudo apt install openjdk-21-jre-headless java -version
For Java 25, install the package from your distribution if apt search openjdk-25 lists it. If it does not, use Eclipse Temurin from Adoptium.
Fix UnsupportedClassVersionError
This error means the server needs a newer Java than the one that ran it:
java.lang.UnsupportedClassVersionError: ... 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.0
The first number is what the server needs and the second is what you ran. Class file version 52 is Java 8, 61 is Java 17, 65 is Java 21 and 69 is Java 25. Install the Java version that matches the first number, then start the server again.
The server still uses the old Java
If java -version is correct but the server still fails, your start script or panel is using a different Java. Call the one you want by its full path:
/usr/lib/jvm/java-21-openjdk-amd64/bin/java -Xms4G -Xmx4G -jar server.jar --nogui
On a game panel, choose the Java version in the server's startup settings instead.
Before you update Minecraft
When you move a server to a new major version, check this table first and update Java before you swap the server jar. Plugins and mods also need versions that match both Minecraft and Java.
Host your Minecraft server in Singapore
Low ping for players in India, Malaysia and Indonesia, on fast AMD EPYC cores with NVMe and DDoS protection.
