// Minecraft

Which Java version does your Minecraft server need? (Java 25 for 26.x)

Which Java version does your Minecraft server need? (Java 25 for 26.x)

A Minecraft server is a Java program, and Java comes in versions that do not always get along. Mojang raises the required Java version every few years, and each time part of the servers strands on an error message that does not seem to say anything about Java. Since Minecraft 26.1 the requirement is Java 25; a server on 1.20.4 needs Java 17, and a nostalgic 1.12.2 modpack wants Java 8. This article gives the full table, shows how to recognise the error and how to switch Java versions without your world or plugins being involved.

The table: Minecraft version and matching Java

  • 1.12.2 and older: Java 8. Newer Javas usually do not work with Forge from that era.
  • 1.13 up to 1.16.5: Java 8 is the base; Java 11 often works too, but Forge modpacks from this period are safest on 8.
  • 1.17: Java 16 minimum.
  • 1.18 up to 1.20.4: Java 17 minimum. Java 21 usually works on Paper, but older plugins and Forge versions can trip.
  • 1.20.5 up to 1.21.x: Java 21 minimum.
  • 26.1, 26.2 and 26.3: Java 25 minimum. This is the current requirement; anyone still on 1.21 wanting to update has a Java upgrade ahead as well as a new server version.

The rule is: use the version Mojang requires as a minimum, or the next LTS version above it. An older Java than required never works; a much newer Java sometimes does not work with plugins or mods that rely on Java internals.

Recognising the error message

The classic message with a Java that is too old is java.lang.UnsupportedClassVersionError: ... has been compiled by a more recent version of the Java Runtime (class file version 69.0), this version of the Java Runtime only recognizes class file versions up to 65.0. The number after "class file version" reveals the requirement: 52 is Java 8, 61 is Java 17, 65 is Java 21, 69 is Java 25. If you see such a line in the console, the server is running under a Java that is too old.

The reverse situation — a Java that is too new — is harder to spot. Forge 1.12 or 1.16 then crashes with messages about ClassCastException, module java.base does not export or Unable to make ... accessible. Then too the fix is not the mod but the Java version.

Checking your Java version

In your server console, start-up usually shows a line like Starting minecraft server version 26.2 followed by information about the runtime; Paper reports the Java version explicitly in the first lines. On a hosted server you pick the Java version in the panel, and the command java -version in an SFTP or console session shows what is active. At MC-Node you choose Java per server in the panel: changing the Java version. On a VPS you install the desired version yourself; the guide for that is installing Java on your VPS.

Switching Java without damage

Switching Java does not touch your world: the save, plugins and configuration are separate from the runtime. What can go wrong is a plugin or mod that relied on the old Java. So do it like this:

  1. Back up the whole server folder.
  2. Stop the server, switch the Java version in the panel (or on the VPS) and start again.
  3. Read the first thirty lines of the console: Java errors appear there, not halfway through.
  4. Test the plugins that sit deepest in the server: permissions, economy, world management.
  5. If it goes wrong, switch back; the world is untouched.

Java 25 and the 26.x versions: what changes

Since 26.1 the server runs on Java 25, and 26.2 and 26.3 keep that requirement. For anyone already on 26.2, nothing changes about Java with 26.3. Anyone coming from 1.21 has to do two things at once: update the Java runtime and put the server software and plugins on a 26.x version. Do not do that on release day: Paper, Purpur and the big plugins usually need a week after a new Minecraft version. What changes in 26.3 itself and which datapacks break is in Minecraft 26.3 and your server.

Java on a VPS: several versions side by side

If you run several servers on one VPS, you often want two Java versions at once: 17 for an old modpack and 25 for a 26.x server. That works without fuss by installing each version in its own folder (for example via the Adoptium packages or the distribution itself) and using the full path to the right java in each server's start script instead of the bare command. That way the script decides which version a server gets, not the system default. Do check after a system update that the default Java has not switched; an apt upgrade can move the symlink and then the server starts with the wrong version.

Memory and Java options

Besides the version, the Java configuration determines how much memory the server may use: the options -Xms and -Xmx set the lower and upper limit. On a hosted server the panel handles that based on the RAM of your plan; on a VPS you set it yourself and leave about 1 GB for the operating system. The widely used "Aikar's flags" for the garbage collector still work fine on Java 21 and 25 and prevent the hiccups a default configuration gives with large worlds.

In short

// TRY IT YOURSELF
Your Minecraft server online in 60 seconds
View packages →