Guide to Fix UnsupportedClassVersion Error in Minecraft 1.20.5 Servers
Introduction
When attempting to launch a Minecraft 1.20.5 server on Ubuntu, you may encounter a frustrating error: UnsupportedClassVersionError
. This issue arises because the server’s main class, net.minecraft.bundler.Main
, was compiled with a more recent version of the Java Runtime (class file version 65.0) than is currently installed on your system, which only supports up to class file version 62.0. This guide will help you resolve this error by updating your Java Runtime Environment to a compatible version.
1 | CloseX@CloseX:~/minecraft/1.20.5$ java -Xmx1024M -Xms1024M -jar server.jar nogui |
This is due to the fact that the latest Minecraft server 1.20.5 requires Java 21.
You can download 1.20.5 server from https://www.minecraft.net/en-us/download/server
1. Update Repository
Use the following command to update the repository.
1 | sudo apt update && sudo apt upgrade -y |
2. Install openjdk-21-jre-headless
1 | sudo apt install openjdk-21-jre-headless |
Let’s try starting the Minecraft server 1.20.5 again.
4. Start Server
1 | java -Xmx1024M -Xms1024M -jar server.jar nogui |
Congratulations and enjoy your game.
Note: On Debian, openjdk-21-jre-headless is not yet included in the Debian stable repository. However, it can be found in the unstable repository.
- Edit /etc/apt/sources.list file
1 | sudo nano /etc/apt/sources.list |
- Add repository
1 | deb http://deb.debian.org/debian sid main |
- Click
ctrl
+o
to save file and clickctrl
+x
to exit
Then update the repository and install openjdk-21-jre-headless