PACKYARDStart your server

Which Java Version for a Minecraft Server? (1.12-26.3)

Published

Short answer: Minecraft 26.1 and newer (including 26.3) needs Java 25. 1.20.5 to 1.21.11 needs Java 21. 1.18 to 1.20.4 needs Java 17. 1.17.x needs Java 16. 1.16.5 and older run on Java 8.

Those numbers come straight from Mojang: every version's metadata file has a javaVersion entry, and that's what the official launcher uses to pick a runtime. We read it for each version below on 2 November 2026.

Minecraft server Java versions

Minecraft versionJava it needsClass file version
26.1 to 26.3Java 2569
1.20.5 to 1.21.11Java 2165
1.18 to 1.20.4Java 1761
1.17 and 1.17.1Java 1660
1.16.5 and older (e.g. 1.12.2)Java 852

The class file version is the number you'll see in the error message when the Java is too old, so this column lets you read the error backwards.

Mod loaders follow the Minecraft version. Paper, Fabric, Forge and NeoForge for 1.21.1 all run on Java 21, and so do modpacks built on 1.21.1 (Cobblemon, All the Mods 10, Create+). Vault Hunters 3 is 1.18.2, so Java 17. RLCraft is 1.12.2, so Java 8.

The "UnsupportedClassVersionError" fix

If the server stops right away with something like:

Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
java.lang.UnsupportedClassVersionError: net/minecraft/bundler/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

your Java is older than the server jar needs. Read the two numbers with the table: 65 is Java 21 and 61 is Java 17, so this is a 1.21 server started on Java 17. Install the newer Java and start the server with it. Nothing in the world or config is wrong.

Check which Java you're running

java -version

The first line shows the major version (for example openjdk version "21.0.5"). If a PC has several Java versions installed, the one on your PATH may not be the one you expect.

Install the right one

Start the server with that Java

Point your start script at the exact java you want instead of relying on PATH:

"C:\Program Files\Eclipse Adoptium\jdk-21...\bin\java.exe" -Xmx4G -jar server.jar nogui

On Linux, sudo update-alternatives --config java switches the default, or use the full path such as /usr/lib/jvm/java-21-openjdk-amd64/bin/java. Set -Xmx to the RAM you want the server to use; the RAM calculator gives a number for your pack and group.

Is newer Java OK for an older server?

Usually, for vanilla and Paper. Java is backward compatible, so a 1.20.4 server generally starts on Java 21. The exception that catches people is old Forge. Forge for 1.12.2 (and RLCraft with it) needs Java 8 and fails on newer Java with an error like:

java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader

If you see that, go back to Java 8. For any modded server, the safe choice is the version in the table, not the newest one you have.

The other direction never works: a jar built for Java 25 won't start on Java 21, however you configure it.

Updating to 26.x

Version 26.1 (March 2026) is where Mojang moved to year-based version numbers and to Java 25. If you update a 1.21 server to 26.3, change Java at the same time or it won't start. Back up first: going back down isn't supported, and when we tried moving a test server from 26.3 back to 1.20.4 it failed to start. Plugins and mods need 26.x builds, so check each one before you move. Our how to make a Minecraft server guide covers the rest of a fresh setup.

On Packyard, Java is set for you

When you order a Packyard server you pick the Minecraft version (Paper, Fabric, Forge or NeoForge, from 1.12.2 up to 26.3, depending on the loader), and we start it on the matching Java. Modpacks get the Java their Minecraft version needs. If you later move a Paper server to a newer version yourself, pick the newer Java under Docker Image in the panel's Startup page; the panel warns about this.

Paper starts at $5 a month for 3 GB ($1.50 per GB of RAM, USD plus applicable taxes), with a permanent yourserver.play.packyard.ca address, daily backups and SFTP. Available in the US and Canada (not Quebec); servers run in US West. Running mods? See modded Minecraft server hosting or the modded server guide.

Start a Minecraft server with the right Java already set, from $5

Minecraft is a trademark of Mojang. Packyard is not an official Minecraft product and is not affiliated with Mojang or Microsoft.

FAQ

What Java version does Minecraft 1.21 need?

Java 21. That covers every 1.21 release up to 1.21.11, and 1.20.5 and 1.20.6 too.

What Java version does Minecraft 26.3 need?

Java 25, the same as 26.1 and 26.2. A 26.x server won't start on Java 21.

What Java do I need for Minecraft 1.20.1?

Java 17. Everything from 1.18 to 1.20.4 uses Java 17, including Forge 1.20.1 modpacks.

Can I use Java 21 for a 1.16.5 or 1.12.2 server?

Vanilla and Paper often start, but old Forge (1.12.2 in particular) needs Java 8. Use Java 8 for those versions to avoid crashes.

Does the Java version on my PC matter for joining a server?

No. The Minecraft launcher brings its own Java for the game. The Java version only matters on the machine that runs the server.

More guides and posts on the Packyard blog.