Java 16, MC 1.17, and Paper

Hi folks.

With the Paper project we always want to push forward and keep improving things. This includes not getting stuck with outdated tooling or outdated systems - and that includes the version of Java we support.

Here we’re announcing 2 things:

  • When we’re going to bump Paper to require Java 16
  • What our policy will be regarding the version of Java Paper will support going forward

When we’re going to bump Paper to require Java 16

With that said I’ll get straight to the point: When Minecraft 1.17 is released and Paper is updated to support it, Paper will bump the JVM requirement to Java 16. Any servers still using Java 8 to run Paper will need to be updated.

So when will this happen exactly? We don’t know, Minecraft 1.17 doesn’t have a set release date and once it is released we don’t know when we’ll have Paper ready for it. But in general we expect 1.17 to be released some time in the summer of 2021. Once we have a more specific release date from Mojang we’ll update our timeline accordingly.

From Paper 1.16.5 build 668 forward the server will log a large warning in the console if it detects the server is running on Java 15 or below. We’re hoping this warning and the several months of advanced notice we’re giving will allow people to be updated long before we drop support for Java 8.

What our policy will be regarding the version of Java Paper will support going forward

Going forward in general Paper will support the latest LTS release of Java, but nothing lower than the version of Java required by vanilla Minecraft. LTS releases happen every 3 years - the next one will be Java 17 in September 2021. Java 11 is the current LTS release of Java.

So the current LTS release at time of release of Minecraft 1.17 will be Java 11, but since Minecraft 1.17 requires Java 16, Java 16 will be our minimum instead. When the next Minecraft version is released, if the requirement is still Java 16, but it’s after the release of Java 17 LTS, we’ll likely bump up to that, since it will now the be the latest LTS release of Java. In more concrete terms, the following logic will decide which version of Java Paper requires:

  • Is the current Java LTS release equal to or higher than the current required Java version for vanilla Minecraft?
    • If yes: That Java LTS release will be required.
    • If no: The version of Java required for vanilla Minecraft will be required.

Questions people will probably ask:

Why?

We don’t want to find ourselves stuck with legacy software or systems. Java has a consistent update cadence now that we can take advantage of. Newer versions of the JVM are always backwards compatible with older code and almost always have performance improvements over older versions. Newer version of Java also have language and JDK advancements that we’d like to be able to use as well.

What version of Java does the Paper team recommend?

Java is remarkably backwards compatible between versions and almost never requires changes to run older code. Because of this the Paper team generally recommends running the most stable recent JVM release so you can take advantage of any potential performance improvements the newer versions may have.

What should I do right now?

You should update to at least Java 16 as soon as you can. Any version after 16 is okay too - but either way you can update right now without any issues.

To update your server, you can follow the following guide: https://paper.readthedocs.io/en/latest/java-update/index.html

What about all of my plugins?

99.9+% of plugins will work perfectly fine on Java 16 with no issues. Almost nothing will break unless the code is doing very bad things. If a plugin does break, you will need to contact the author of said plugin, because no Minecraft server will be 1.17 and running Java 15 or below.

Didn’t this say Java 11 (insert time) ago?

Yes! Mojang surprised us with the release of snapshot 21w19a, which declared that Minecraft would now use Java 16 going forwards. That being said, should Mojang revert this decision, we might simply move back to Java 11 as our requirement.

12 Likes

How do I check my Java version?

Open a Command Prompt, Terminal or similar, and type in java -version
If you are on Java 8, the output will look similar to version "1.8.0_265"
If you are on Java 16, the output will look similar to version "16.0.0"

How do I update to Java 16?

On Windows: Check out https://adoptopenjdk.net/
On other systems: Use your system package manager, or use AdoptOpenJDK. You will need to switch to OpenJDK. The package you are looking for should be something like openjdk-16-jre

During the installation process, you might be asked if you want to set your JAVA_HOME. You should do that, since it determines which Java Version the java command is using.
To see which version the java command uses, you can type java -version. You might need to reopen your Terminal/Command Prompt after the installation.

5 Likes

Will plugins that release a Multi-Release jar work properly? By that I mean that the PluginClassLoader will find those classes that live in the META-INF/versions/<release>/ directory if the jvm that is running is as recent or more recent than the <release> version?

The reason I’m asking is because there’s still a use case for plugin developers to support Java 8 because many Spigot servers will still run on Java 8 and some really useful internal api’s have become inaccessible on later releases, but the alternatives that have been provided in Java 11 are not available on Java 8.

Yes, they should work just fine. Maven shouldn’t care at all, but Gradle needs you to specify you want to depend on newer Java version code in your code (which is a one-liner, anyways).

1 Like

Per the documentation of URLClassLoader, which PluginClassLoader is, yes.

However, in most cases you won’t need the complexity of a multi-release jar. Building against Java 8 is fine enough for compatibility.

Not if you use deprecated apis that have been removed in modern versions (where replacements are available).

This is getting tracked in https://github.com/PaperMC/Paper/issues/4841
Further discussion should happen there.

How do I update to Java 11 on my dedicated Minecraft server on Anvilnode?
I get this

error in the console. And I also don’t see any button to update to a newer Java version.

1 Like

That doesn’t look like a dedicated server. If it is just connect via ssh and update the java version. If you’re on Debian 8 I can give advice how to upgrade to Debian 9 and afterwards to Debian 10. The installing java using apt update && apt install openjdk-11-jre should work fine.

1 Like

How do I update Java in Pterodactyl Panel? I found this: https://hub.docker.com/r/tuxifan/pto-java-11/dockerfile but after install it throws error:

/entrypoint.sh: line 8: ip: command not found

The original project installs iproute2. So you need to fix that docker file. Simply the command executed in the entrypoint.sh isn’t available in the modified version.

Oh you opened an issue on Github already.

1 Like

Yes I opened new issue on GitHub but it seems that this repo is very old and no longer maintained. I don’t really know Docker but I will try to fix it.
And one thing: what url do I need to enter in Pterodactyl Docker Image in order to pull that fixed Dockerfile? GitHub link does not work and as I said I do not know Docker.

You push the docker image to docker hub and pull it from there. At least that’s the easiest way for public stuff. I started fixing it as well. Will be Ubuntu 20.04 based after that.
Ping me if you’ve problem updating it yourself.

EDIT: @PoProstuMieciek
The updated version on Github:

Here you’re: https://hub.docker.com/repository/docker/ysl3000/docker-java-11/general

1 Like

@ysl3000 I pulled your fix from DockerHub but it is crashing after starting the server.
Here is console log:

openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
:/home/container$ eval echo java -Xms128M -Xmx${SERVER_MEMORY}M -Dterminal.jline=false -Dterminal.ansi=true -jar ${SERVER_JARFILE}
java -Xms128M -Xmx4096M -Dterminal.jline=false -Dterminal.ansi=true -jar paper-1.16.4-320.jar
[email protected]~ Server marked as offline...

[Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon]: Exit code: 0
[Pterodactyl Daemon]: Out of memory: false
[Pterodactyl Daemon]: Aborting automatic reboot: last crash occurred less than 60 seconds ago.

How do I fix it? I think that there is something wrong with Java startup command (java -Xms128M -Xmx4096M ...).

This docker command under the hood works well. I don’t know what pterodactyl panel does there.

docker run -v “$(pwd)”/:/home/container/ -p 25565:25565 ysl3000/docker-java-11 java -Xms128M -Xmx2048M -Dterminal.jline=false -Dterminal.ansi=true -jar paper-server-1.16.4-R0.1-SNAPSHOT-all.jar --nogui

Is your /home/container/ folder present/mapped?

@ysl3000 Yes I have and it still does not work. Still the same error.

eval echo

The container is running the wrong command? You want to be using one of pteros actual images that they offer, I’d suggest asking the ptero discord for support

Just as a comment… There does seem to be a performance difference between the Oracle Java and the OpenJDK-Java 11.

Perhaps it’s due to my host being more optimized for the Oracle-version (although i expected them to use the same switches) … But with the OpenJDK the TPS wasn’t able to keep up to my 20/20/20 values.

That’s not possible. The code is 99.9% the same. The difference between oracle jdk and openjdk is the licence.

ok :wink: I believe you. Am not an expert in that domain, so i trust those who are :slight_smile:
Perhaps a coincidence then… but it was a long time ago that i saw the message “Can’t keep up” :smiley:

They have a java 11 docker image. https://github.com/pterodactyl/images/tree/java-11