Skip to content

Instantly share code, notes, and snippets.

@Proximyst
Last active July 27, 2021 17:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Proximyst/67615353e2575a71faaff3f7ae9cc2b4 to your computer and use it in GitHub Desktop.
Save Proximyst/67615353e2575a71faaff3f7ae9cc2b4 to your computer and use it in GitHub Desktop.
Paper update guide to Java 16.

Java 16

Introduction

As of Minecraft 1.17, Paper will only support Java 16 and above. This is in line with our new policy of only supporting the last two long-term-support (LTS) versions of the Java runtime. Although Minecraft 1.17 requires a Java version that is too new for any LTS, we will maintain our policy as far as possible. We will only support Java 16 and above because of Mojang Studios deciding to bump their own Java requirement with 1.17.

To update, please find the appropriate header for your usecase.

If you're a developer or want to be on the safe side, pick the JDK options in the guides instead of a generic JRE. The JDK contains the JRE, in addition to development material (sources, documentation, a reference compiler, and more).

Shared host

Back to top

If you cannot find your host in the following list, you should open a support ticket with your host's website to ask how to update.

Apex Hosting

Apex Hosting is already on Java 16 for both Paper and Waterfall. You don't need to do anything to update.

Aternos

If you run Paper, you should have Java 16 selected automatically. If you run Minecraft 1.16 or earlier, you can change this in the server configuration panel on their website to Java 8, 11, or 16:

Environment on aternos.org

Bloom.Host

You can select to use Java 16 from the server configuration panel by selecting the option ending in openjdk-16:

Server configuration panel on Bloom.Host

Creeper.Host

CreeperHost has some terrific documentation on how to do this on their website: https://wiki.creeper.host/books/minecraft-java-edition/page/changing-java-version

DedicatedMC

When loading Minecraft 1.17, the server will automatically be set to Java 16, and you don't need to do anything whatsoever. If you wish to test Java 16 before updating, you can set this yourself in the Startup Settings panel:

Server Settings panel on DedicatedMC.io

See the following guide for more information: https://docs.dedicatedmc.io/server-setup/how-to-change-your-servers-java-version/

MCProHosting

When loading 1.17, the server will automatically be set to Java 16 and you don't have to do anything whatsoever. If you want to test Java 16 on Minecraft 1.16 or earlier, you will need to set the server type to Snapshot, then put Paper back on the server manually.

PebbleHost

PebbleHost has a great guide in their knowledgebase on their website: https://help.pebblehost.com/en/article/does-pebblehost-support-java-11-java-16-1f5zlk2/

Debian/Ubuntu

Back to top

To install Java 16 on Debian or Ubuntu, you will want AdoptOpenJDK's JRE. This is available under their apt repository, and they themselves also have a guide on how to install it on their website: https://adoptopenjdk.net/installation.html#unknown. Follow their guide if you find this guide insufficient.

To start off, you need to run one of the following commands:

  • Ubuntu: export CODENAME="$(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2)"
    If you now test echo $CODENAME, it should output something like focal, bionic, or others.
  • Debian: export CODENAME="$(cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2)"
    If you now test echo $CODENAME, it should output something like buster, stretch, or others.

You may now ensure you have the necessary packages by running the following: sudo apt-get install wget apt-transport-https gnupg

The following will import their GPG key (which is used to ensure the packages are from them -- this is necessary to act on any apt repository): wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -

You now need to add their apt repository. First remove the existing repository, if you already have one: sudo rm -f /etc/apt/sources.list.d/adoptopenjdk.list
Then add the new one using the previous codename: echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb $CODENAME main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list

You may now install the Java version as usual with apt/apt-get:

sudo apt-get update
sudo apt-get install adoptopenjdk-16-hotspot

Pterodactyl

Back to top

NOTE: To switch using Pterodactyl, you'll need an administrator account.

NOTE: The names of these will be different depending on your language.

Open the Pterodactyl administrator control panel, go to the Servers tab, click on your server (this has to be repeated for every server), and press the Startup tab.

Replace the text in the Image input field under Docker Container Configuration with: quay.io/parkervcp/pterodactyl-images:debian_openjdk-16.

Startup tab image

Arch Linux

Back to top

To install Java 16 on Arch Linux, you will need to use the Arch User Repository (AUR). You need to install the jdk-adoptopenjdk package (see yay to simplify the installation and update processes). To switch between Java versions, see the Arch Linux wiki on Java: https://wiki.archlinux.org/title/Java#Switching_between_JVM.

Linux (Generic)

Back to top

NOTE: You should check with your distribution's package manager before using this guide. It is very likely you will get results you want if you search its repositories by java, openjdk, or jre.

SDKMAN!

Install SDKs with ease! Wa-pow! Luckily SDKMAN! is written in Bash, so you can use this on practically any Linux (and BSD!) environment. Follow their installation instructions for SDKMAN! itself on their website: https://sdkman.io/install.

You can then proceed to install one of their many Java distributions, available at their website: https://sdkman.io/jdks.

AdoptOpenJDK / GraalVM

NOTE: This assumes an intermediate to advanced Linux user. Ask for help if you need it; we don't want you to harm your system. #paper-help is a fitting channel for asking, and remember: don't ask to ask, just ask.

You're going to require the tar and sha256sum tools to do this install.

First pick a distribution to install:

  • AdoptOpenJDK: Select the appropriate tar.gz file and copy the download URL.
  • GraalVM: Go to download and select the appropriate distribution of Graal. Get a link to the tar file you need -- if you select Community Edition, you will likely only want the appropriate tar.gz link.

Now that you've found the links you'll want, move on to find a directory you wish to install Java into. This is commonly /usr/lib/jvm. The tar files you've copied the link to both have an inner directory, so you don't need to create one yourself.

Download the file:

  • With curl: curl -LJO $url
  • With wget: wget $url

And verify the signature of the file:

  • If you downloaded AdoptOpenJDK, get the hash via: curl -L ${url}.sha256.txt
  • If you downloaded GraalVM, get the hash via: curl -L ${url}.sha256

Get the hash of your downloaded file with sha256sum $file_name and ensure it's the same as the outputs from the curled hashes. If they are not the same, delete the files and download them again.

We now know the file is correct, so let's extract it: tar xzf $file_name. This should take a second or two, then a new directory should be made. For AdoptOpenJDK it should be named something like jdk-16.0.7+10/, and for GraalVM it should be named something like graalvm-ce-java16-20.3.0/. You can now safely delete the tar.gz file.

You will now want to add a new environment variable called JAVA_HOME pointing to the directory you created (e.g. /usr/lib/jvm/graalvm-ce-java16-20.3.0):

$ echo <<EOF
export JAVA_HOME=/usr/lib/jvm/graalvm-ce-java16-20.3.0
export PATH=$JAVA_HOME/bin:"$PATH"
EOF | sudo tee /etc/profile.d/java.sh
$ sudo chmod +x /etc/profile.d/java.sh

You must now source this file. This is usually done on the init of your shell, so you can just reopen the shell.

Windows

Back to top

If you're on Windows, you will want AdoptOpenJDK's JRE. This is available under the following link: https://adoptopenjdk.net/releases.html. AdoptOpenJDK themselves have an installation guide if the following is insufficient: https://adoptopenjdk.net/installation.html#unknown.

You must find the first entry that says "Windows" and an "x64" next to it (if you're an x86 user, you should pick this -- if you're unsure, pick x64). You will then want to pick the option on the far-right that says "JRE - ## MB" and press the ".msi" button. Install the downloaded file as usual by opening the downloaded file and following the on-screen guide. Reboot your computer after installing.

Checking version

If you now open a new PowerShell prompt and do java -version, it should say something along the lines of:

openjdk version "16.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 16.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16.0.7+10, mixed mode)

It is the version "16.0.7" part that's important -- if the first number is not 16, you need to modify your PATH.

Modifying your PATH

Press your Windows button and search (just start typing) environment variable. The first result (Edit the system environment variables) is the one you want.

Searching for environment variables

Select the environment variables settings:

Selecting the environment variables

Select the existing JAVA_HOME variable and press Edit..., OR create a new variable in the LOWER half of the window via New... and name it JAVA_HOME. You now want to Browse Directory... and find the Java directory under C:\Program Files\AdoptOpenJDK in the explorer window:

Editing variable

Now go to your Path variable in the LOWER window and press Edit.... If there already is a %JAVA_HOME%\bin entry in the list, skip this step. Press the New button at the top and enter %JAVA_HOME%\bin.

Adding the Path

If you now open a new PowerShell window, you should have the correct output. If not, restart your computer and try again. If it is still wrong, ask for help in #paper-help on Discord to get further guidance.

macOS / OS X

Homebrew

Back to top

If you're on macOS, you can use a tool called Homebrew to install Java. Follow the instructions to install it on their website here.

After doing so open a new terminal and run the following two commands:

brew tap AdoptOpenJDK/openjdk
brew install --cask adoptopenjdk16-jre

For a complete list of their available Java versions, see the following: https://github.com/AdoptOpenJDK/homebrew-openjdk#available-versions

Checking version

If you now open your app launcher and find the Terminal app, then run java -version, it should say something along the lines of:

openjdk version "16.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 16.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16.0.7+10, mixed mode)

It is the version "16.0.7" part that's important -- if the first number is not 16, you need to modify your PATH.

Modifying your PATH

TODO: I need help here. I don't own a macOS computer, and cannot finish this guide! Please contact Proximyst on Discord or EsperNet IRC to help me out!

Manually

Back to top

If you're on macOS, you will want AdoptOpenJDK's JRE. This is available under the following link: https://adoptopenjdk.net/releases.html. AdoptOpenJDK themselves have an installation guide if the following is insufficient: https://adoptopenjdk.net/installation.html#unknown.

You must find the first entry that says "macOS". You will then want to pick the option on the far-right that says "JRE - ## MB" and press the ".pkg" button. Install the application by opening it and following the on-screen guide.

Checking version

If you now open your app launcher and find the Terminal app, then run java -version, it should say something along the lines of:

openjdk version "16.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 16.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 16.0.7+10, mixed mode)

It is the version "16.0.7" part that's important -- if the first number is not 16, you need to modify your PATH.

Modifying your PATH

TODO: I need help here. I don't own a macOS computer, and cannot finish this guide! Please contact Proximyst on Discord or EsperNet IRC to help me out!

@HexedHero
Copy link

Pterodactyl now has its own official Docker image for Java 11
quay.io/pterodactyl/core:java-11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment