Determining the Correct Java Version for Operating a Minecraft Server

written by Niklas Friedrich Gerstner on January 31, 2025

Why 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 VersionJava Version
65.0Java 21
64.0Java 20
63.0Java 19
62.0Java 18
61.0Java 17
60.0Java 16
59.0Java 15
58.0Java 14
57.0Java 13
56.0Java 12
55.0Java 11
54.0Java 10
53.0Java 9
52.0Java 8
51.0Java 7
50.0Java 6
49.0Java 5
48.0Java 4
47.0Java 3
46.0Java 2
45.3Java 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 or sdk 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.