Running a Minecraft server on the wrong version of Java is one of those silent killers — everything looks fine until you try to launch and get hit with an error like Unable to load main class or the server simply refuses to start. Different Minecraft versions have strict Java requirements, and if your server is pointing to the wrong Java executable, it won’t run.
This guide covers which Java version your server needs, how to change it on the Physgun Gamepanel, and how to change it manually on a self-hosted or VPS setup.
On Physgun’s Minecraft server hosting, switching Java versions is a simple dropdown in your server’s Startup settings — no command line needed.
Java Version Requirements by Minecraft Version
| Minecraft Version | Required Java Version |
|---|---|
| 1.21.1+ | Java 21 or newer |
| 1.20.5 – 1.18 | Java 17 or newer |
| 1.17.1 – 1.17 | Java 16 or newer |
| 1.16.5 and older | Java 8 |
Using a version older than the minimum will prevent your server from starting. Using a newer version than required is generally fine.
Method 1: Change Java Version on Physgun
Physgun handles Java version switching directly through the Gamepanel — no file editing required.
-
Log in to the Physgun Gamepanel and select your Minecraft server.
-
Navigate to Configuration > Startup.
-
Find the Java Version dropdown and select the version that matches your Minecraft version (refer to the table above).
-
Save your changes and restart the server.
The server will now launch using the selected Java version.
Method 2: Change Java Version on a Self-Hosted or VPS Server
On a self-hosted server, Java is invoked through your startup command or launch script. You need to point it to the correct Java executable.
Step 1: Check Installed Java Versions
Run the following to see what Java versions are installed on your system:
Linux:
update-java-alternatives --listWindows:
where javaIf the version you need is not installed, download it from Adoptium (the recommended OpenJDK distribution for Minecraft servers).
Step 2: Update Your Startup Script
Open your server launch script (typically start.sh on Linux or start.bat on Windows) and update the Java path to point to the correct version.
Linux example (switching to Java 21):
/usr/lib/jvm/java-21-openjdk-amd64/bin/java -Xms1G -Xmx4G -jar server.jar noguiWindows example (switching to Java 21):
"C:\Program Files\Eclipse Adoptium\jdk-21\bin\java.exe" -Xms1G -Xmx4G -jar server.jar noguiReplace the path with wherever your desired Java version is installed.
Step 3: Verify the Change
Start your server and check the startup logs. Near the top you should see a line indicating which Java version was used, for example:
Java Version: 21.0.3If the server starts without errors, the change was successful.
Troubleshooting
Unable to load main class or server won’t start
Your current Java version is too old for the Minecraft version you’re running. Install the correct version and update your startup command to point to it.
UnsupportedClassVersionError in the logs
Same cause — the server jar was compiled for a newer Java version than what is running it. Upgrade Java.
Multiple Java versions installed but wrong one is being used
On Linux, you can set the system default with:
sudo update-alternatives --config javaOr simply specify the full path to the correct Java binary in your startup script to avoid ambiguity.
Server starts but mods crash immediately
Some mods have their own Java version requirements. Check the mod’s documentation and ensure your Java version satisfies both the server and the mod requirements.
If you’re on Physgun and run into any issues, open a support ticket and our team will help you get the right version running.
