UnsupportedClassVersionError: which Java you need
Also available in: Русский
Your server won't start with an UnsupportedClassVersionError or A JNI error has occurred? Almost always it means one thing: you have the wrong Java version. The server needs a newer Java than the one installed. Let's figure out which Java you need and how to install the right one.
In the logs the error looks like this:
Error: A JNI error has occurred, please check your installation and try again
java.lang.UnsupportedClassVersionError: net/minecraft/server/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 recognizes class file versions up to 61.0
What the error means
The server core was built for a newer Java than you have installed. The error text gives a hint: class file version 65.0 is Java 21, while up to 61.0 means Java 17 is installed. So you need to install a newer Java.
Which Java you need per Minecraft version
| Minecraft version | Java version |
|---|---|
| 1.16.5 and older | Java 8 |
| 1.17.x | Java 16 (17 works too) |
| 1.18 – 1.20.4 | Java 17 |
| 1.20.5 and newer (1.21+) | Java 21 |
Some very old modded packs specifically need Java 8 — even if you install a newer one, keep Java 8 around.
How to install the right Java
-
Install the version you need. The quick way on Windows is
winget:winget install Amazon.Corretto.22.JDKSwap the number for the version you need:
Amazon.Corretto.21.JDK(for 1.21+),Amazon.Corretto.17.JDK(1.18–1.20.4),Amazon.Corretto.8.JDK(older versions). Or download Eclipse Temurin from the Adoptium site. -
Check the installed version:
java -version -
Restart the server.
If you have several Java versions installed, the server may launch with the wrong one. Point to the right
java.exein your start script — or let ProximaClient handle it.
With ProximaClient — Java is installed for you
ProximaClient installs the right Java version for the Minecraft version you picked — the version error simply doesn't happen. And if needed, you can change the Java version manually in the server's "Launch parameters".
FAQ
How do I check the installed Java version? Run java -version in the command line.
What's the "class file version" in the error? It's Java's internal version number: 52 → Java 8, 55 → 11, 61 → 17, 65 → 21. Compare it with the number in the error.
I installed a new Java but the error remains. The server is probably launching with an old Java (you have several). Point to the right java.exe in the start script, or use ProximaClient.
The opposite error — Java too new? Old cores (for 1.8–1.12) are best run on Java 8: they may not work on a recent Java.
Easier — with ProximaClient
Don't want to juggle Java versions — ProximaClient installs the right one automatically and lets you switch it in a couple of clicks. If you're just creating a server, start with the How to create a Minecraft server on your PC guide. Download for Windows →