Fix Minecraft "UnsupportedClassVersionError" (Wrong Java Version)
UnsupportedClassVersionErrorcompiled by a more recent version of Javaclass file versionThis error means your server jar needs a newer Java than the one running it. Modern Minecraft needs modern Java — here's how to match them and avoid it again after your next version upgrade.
What the error means
UnsupportedClassVersionError ... compiled by a more recent version of the Java Runtime means the server jar was built for a newer Java than you have installed. The fix is simply installing and using the right Java version.
Which Java does my Minecraft need?
Match your Minecraft version to the Java it was built for — this table covers the modern releases:
| Minecraft version | Java required |
|---|---|
| 1.20.5+ / 1.21 | Java 21 |
| 1.18 – 1.20.4 | Java 17 |
| 1.17 | Java 16 |
| 1.16.5 and older | Java 8 |
"UnsupportedClassVersionError" always means Java is too old for the jar. Match the table rather than just grabbing the newest Java, though: modern versions (1.17+) are happy on Java 17/21, but old Minecraft (1.16.5 and earlier) genuinely needs Java 8 and can misbehave on newer runtimes. Use the version the table lists.
Install the right Java
Install a modern JDK (Temurin/Adoptium is a good choice), then verify the version:
# Debian/Ubuntu example
apt install temurin-21-jdk
java -version # should report 21
Point the server at it
If you have several Java versions, call the right one explicitly in your start script instead of the system default:
/usr/lib/jvm/temurin-21-jdk/bin/java -Xmx4G -jar server.jar nogui
Running an old 1.12 modpack? It needs Java 8 — newer Java will break it. Match Java to the Minecraft version, not "newest is best".
The jar needs newer Java than you have. Match Java to the Minecraft version (1.21 needs Java 21) and call it explicitly in the start script.
Managing multiple Java versions on one machine
If you run several servers on different Minecraft versions on the same box, install each required JDK side by side and reference the full binary path per server rather than relying on the system default — that's what stops one server's Java update from breaking another. On Debian/Ubuntu, update-alternatives --list java shows every JDK installed, and update-alternatives --config java lets you pick the system default interactively.
Related errors
If the server starts but then runs out of memory, see fixing Minecraft "out of memory" (Java heap space) and how to allocate more RAM to a Minecraft server. If it starts fine but lags under load, see fixing "Can't keep up! Is the server overloaded?".
Minecraft is a trademark of Mojang Synergies AB / Microsoft. ESAGAMES is an independent hosting provider, not affiliated with or endorsed by Mojang or Microsoft.
Java handled automatically
Our Minecraft hosting runs the correct Java for your version out of the box — one-click setup, protected in Frankfurt.
Frequently asked questions
What Java version does Minecraft 1.21 need?
Java 21. Minecraft 1.20.5 and newer require Java 21; 1.18–1.20.4 need Java 17; 1.17 needs 16; and 1.16.5 or older run on Java 8.
What causes "UnsupportedClassVersionError"?
The server jar was compiled for a newer Java than the one running it. Install the Java version that matches your Minecraft version and start the server with it.
Can I just install the newest Java for everything?
No — older versions and old modpacks (e.g. 1.12) need Java 8 and break on newer Java. Always match the Java version to the Minecraft version you're running.
How do I check which Java versions are installed on my server?
Run java -version for the default, and on Debian/Ubuntu update-alternatives --list java to see every JDK installed and switch the system default.
Can a game panel run the wrong Java version even if it's installed correctly?
Yes — panels like Pterodactyl select a Java version per egg/Docker image. If the egg is set to an older image than your Minecraft version needs, you'll see this error even with the right JDK installed on the node.
Do I need to reinstall the server after fixing the Java version?
No — the server jar itself doesn't need reinstalling. Just point the start command at the correct Java binary and restart.
Go deeper on this
Guides and explainers that pair with this fix — from our guides and blog.
How to Make a Minecraft Server
Set up a Java server from scratch — version, server.properties, EULA and going live.
ReadSettings to Reduce Minecraft Lag
View distance, Paper tuning and pre-generation for a smooth 20 TPS.
ReadBest Free Minecraft Plugins
EssentialsX, LuckPerms, WorldGuard and CoreProtect — the essentials.
ReadBest Minecraft Modpacks to Host
The best packs to run, and the RAM each one needs.
ReadMinecraft Modpack Hosting
One-click hosting for All the Mods, RLCraft, Cobblemon and more — with recommended RAM.
ReadRelated articles
Fix AMX Mod X "Couldn't load library" / Plugin Failed in CS 1.6
AMXX plugin stuck on "bad load", "couldn't load library" or "failed"? The real causes and the exact fix.
Read fix Game ServersFix FiveM "Couldn't load resource" / Failed to Start
A FiveM resource won't start or throws "couldn't load resource"? Here are the real causes and fixes.
Read fix Game ServersFix Rust Oxide / uMod Plugins Not Loading
Oxide/uMod plugins not loading after a Rust update? The usual causes and the quick fix.
Read fix