Determining the Correct Java Version for Operating a Minecraft Server
written by Niklas Friedrich Gerstner on January 31, 2025Why is the correct Java version important?
When setting up a Minecraft server, you may receive an error message indicating an incompatible Java version. This happens when the Minecraft server software has been compiled with a newer Java version than your current runtime environment supports. In this article, you will learn how to determine and install the correct Java version.
Typical Error Message
An example of such an error message:
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
This message means that your installed Java version does not match the version required by the Minecraft server. The solution is to update to the appropriate Java version.
Determine the required Java version
Each Java version has its own Class File Version, which indicates which Java version is required to run it. The following table shows the mapping:
Class File Version | Java Version |
---|---|
65.0 | Java 21 |
64.0 | Java 20 |
63.0 | Java 19 |
62.0 | Java 18 |
61.0 | Java 17 |
60.0 | Java 16 |
59.0 | Java 15 |
58.0 | Java 14 |
57.0 | Java 13 |
56.0 | Java 12 |
55.0 | Java 11 |
54.0 | Java 10 |
53.0 | Java 9 |
52.0 | Java 8 |
51.0 | Java 7 |
50.0 | Java 6 |
49.0 | Java 5 |
48.0 | Java 4 |
47.0 | Java 3 |
46.0 | Java 2 |
45.3 | Java 1.1 |
If your server shows the error message with Class File Version 65.0, you need at least Java 21.
Check Docker image tag for itzg/minecraft-server
If you are running the Minecraft server in Docker, you may be using the image itzg/minecraft-server
.
This image has various tags with different Java versions.
A list of available tags can be found in our Configurator for Minecraft: Java Edition Server with Docker.
Import your compose.yml
, select the appropriate image tag, and update your file accordingly.
Check Java version on your system
If you are running your Minecraft server without Docker, you can check your current Java version with the following command in PowerShell (Windows) or Terminal (macOS/Linux):
java -version
If the installed version is not sufficient, you can install a newer version.
To install Java 21, use the following instructions:
- Windows: Download Java from Adoptium or use
winget install EclipseAdoptium.Temurin.21.JDK
in PowerShell. - macOS: Install Java with
brew install temurin21
(Homebrew required). - Linux: Use your system's package manager (
apt
,dnf
,pacman
orsdk install java 21-tem
with SDKMAN!).
If you need a different Java version, replace 21
in the above command with the corresponding version number.
Conclusion
The correct Java version is crucial for the error-free operation of a Minecraft server. If you receive an UnsupportedClassVersionError
, check the required Java version based on the Class File Version and update your installation accordingly.
By using the appropriate Java version or a suitable Docker image, you can start and run your server without any issues.