Skip to content
Game Servers

Fix Minecraft "UnsupportedClassVersionError" (Wrong Java Version)

UnsupportedClassVersionErrorcompiled by a more recent version of Javaclass file version
6 min read Updated 12 June 2026 ESAGAMES Team

This 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 versionJava required
1.20.5+ / 1.21Java 21
1.18 – 1.20.4Java 17
1.17Java 16
1.16.5 and olderJava 8
This error = Java too OLD, but don't overshoot

"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
Older modpacks want Java 8

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?".

Java handled automatically

Our Minecraft hosting runs the correct Java for your version out of the box — one-click setup, protected in Frankfurt.

Minecraft hosting
FAQ

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.

Further reading

Go deeper on this

Guides and explainers that pair with this fix — from our guides and blog.

Knowledge base

Related articles

Skip the troubleshooting

Managed, protected hosting in Frankfurt — we handle the Linux, the network and the DDoS so you don't have to.

Payments Secure checkout with cards, banking apps and digital wallets.

Choose the payment flow that fits your stack and region without leaving the platform.

Pay by Zen Visa Mastercard Paysafecard PaysafeCash Skrill Trustly Bancontact UnionPay iDeal WebMoney