How to Change the Java Version on Your Minecraft Server
Match the right Java version to your Minecraft server version. Java 8, 16, 17, and 21 requirements and how to switch.
Different Minecraft versions require different Java versions. Running the wrong Java version is the #1 cause of "server won't start" errors after a version change.
Java Requirements by Minecraft Version
| Minecraft Version | Required Java | Notes |
|---|---|---|
| 1.7.10 – 1.16.5 | Java 8 | Legacy modpacks (1.12.2, 1.7.10) need Java 8 specifically |
| 1.17 – 1.17.1 | Java 16 | Brief transition version |
| 1.18 – 1.20.4 | Java 17 | Most common modern version |
| 1.20.5 – 1.21.x | Java 21 | Current modern requirement |
| 1.21.5+ | Java 21+ | Future versions may require Java 21 LTS |
Forge/NeoForge/Fabric note: Mod loaders mostly follow vanilla's Java requirements, but some mods are stricter. Check the modpack documentation if a specific Java version is recommended.
Change the Java Version
Stop the server
In the XGamingServer Panel, go to Console and stop your server.
Open Startup
Click Startup in the sidebar.
Find the Java version selector
Look for Java Version, Docker Image, or JVM — the exact label varies. The dropdown lets you pick from supported Java versions.
Select the right version
Match your Minecraft version against the table above. Click the dropdown and select the corresponding Java version.
Restart the server
Restart from Console. The server reboots with the new Java version.
Common Java Errors
| Error | Cause | Fix |
|---|---|---|
UnsupportedClassVersionError | Java is too old for the Minecraft version | Upgrade Java |
java.lang.reflect.InaccessibleObjectException | Java is too new for an older Minecraft version | Downgrade Java |
Could not reserve enough space for object heap | Allocated more RAM than the system has | Lower RAM allocation |
Error: A JNI error has occurred | Java/Minecraft version mismatch | Check version compatibility |
| Server starts but immediately crashes | Often Java version mismatch | Check Console for the specific error |
Verify the Active Java Version
In Console, look for the startup log. The first few lines usually show:
[Server] Starting org.bukkit.craftbukkit.Main
[Server] Starting Minecraft server version 1.21.4
[Server] Loading libraries, please wait...If the version is wrong or the server fails to start, you'll see Java-related errors instead.
Modded Servers and Java
| Loader | Typical Java |
|---|---|
| Forge 1.12.2 | Java 8 |
| Forge 1.16.5 | Java 8 |
| Forge 1.18+ | Java 17 |
| Forge 1.20.5+ | Java 21 |
| NeoForge 1.20.4+ | Java 17 |
| NeoForge 1.21+ | Java 21 |
| Fabric 1.18+ | Java 17 |
| Fabric 1.20.5+ | Java 21 |
Java Memory Flags (Aikar's Flags)
After setting the right Java version, use Aikar's optimized JVM flags to get the best garbage collection performance for Minecraft. These flags are version-aware — Java 17/21 uses different flags than Java 8.
Related Guides
How is this guide?
