Upgrading to Java 16 from the MineOS Turnkey ISO

Update: The MineOS Turnkey ISO ships with Java 16 as of June 28, 2021

Here are the steps I used to upgrade Java 8 to Java 16 on an installation of the official MineOS ISO. These steps are executed on the MineOS server as root. Ensure there are no running servers or java processes.

apt remove java-common
wget https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz
tar -xf openjdk-16.0.1_linux-x64_bin.tar.gz -C /opt/
ln -s /opt/jdk-16.0.1/bin/java /usr/bin/java

Why are these steps necessary?

This ISO is distributed as Debian “Stretch”, which does not have access to the same repositories as Debian “[anything after Stretch]”. Ultimately, distros will grow older and not have access to new software by default.

Explanation of steps

apt remove java-common
– Remove the default java installation (8). This also removes the file used to launch java which is located at /usr/bin/java.

wget https://download.java.net/.../openjdk-...bin.tar.gz
– Download a Java that is Debian binary-compatible

tar -xf openjdk-16.0.1_linux-x64_bin.tar.gz -C /opt/
– Extract the contents to some directory (in this case, /opt because is it a well-accepted location for Java)

ln -s /opt/jdk-16.0.1/bin/java /usr/bin/java
– Ensure java the binary can be found by root in the $PATH variable. By adding a symlink to /usr/bin which is always part of root's path, this should allow MineOS and users logged in as root (or otherwise) to access java simply.

5 Likes

Fantastic, thank you. Will try this out over the weekend!

Does this allow MineOS to run normally?
I have built a server at home for my kids and myself to play on.
There are currently 7 live worlds, ranging from Galacticraft 1.12.2 with Forge to Vanilla 1.16.4.
My kids are really excited about 1.17.x and as outlined on this forum, Java8 won’t cut it.
If I bring down any of the worlds my kids will surely kill me, they play on the servers daily.
If the answer is have a go and see I’m cool with that. I’ll spin up a VM and test each world, but if it should work okay, then I’d rather apply the fix directly to the main MineOS server.
I’m running MineOS on top of Ubuntu Server 20.04.

installing a new version of Java should not break existing worlds. They will have to be stopped temporarily to install the new version.

1 Like

Just to share, been a long time user of mineos (since 1.7.10 days) and I can confirm since Mojang’s 21w19a snapshot release now requiring java 16 as JDK 15 has been superseded, hexparrot instructions work with no issues you just have to change the from 15 to 16 for source download, extracting & linking (see modifications below), I been running mineos on a dedicated dell r610 & vmware esxi host and the update works thanks to @hexparrot for keeping this project alive

Just make sure you shut down all minecraft instances and confirm no java service is running using ps command

modifications to instructions:
wget https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz
tar -xf openjdk-16.0.1_linux-x64_bin.tar.gz -C /opt/
ln -s /opt/jdk-16.0.1/bin/java /user/bin/java

4 Likes

Thank you for the updated instructions!

Tom, I had to change your last command to be /usr/bin/java instead of /user/bin/java. I also removed the existing java symlink in /usr/bin before creating the new one.

Do you think there will be any issues in not running apt remove java-common apart from manually removing the file in /usr/bin/java?

1 Like

Update – Server seems to be running well. Checking for java after SSH’ing to the computer shows the correct version:

mc@mineos-tkldev ~$ java --version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-24)
OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

I upgraded to openjdk 16, but now my servers won’t start. Any ideas?

Running MIneOS Turnkey x64 “Stretch”

root@MineOS-2 …/games/minecraft# java -version
openjdk version “16.0.1” 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-24)
OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

I deleted all my java arguments and that worked. The arguments I was using with openjdk 8 must not be compatible with openjdk 16.

1 Like

EDIT: I managed to solve it by reinstalling MineOS Turnkey and before attempting the steps in this guide, I headed to /usr/bin and manually deleted the jar symlink (I believe it was).

If anyone else has the same problem, here is what I did:

  1. Did a full reinstall of MineOS Turnkey from my USB stick

  2. Using FileZilla, I connected to the MineOS computer from my personal computer as root and headed to /usr/bin and removed the jar symlink manually. (If I tried accessing /usr/bin/jar, an error message stating it doesn’t exist appears. I downloaded the file before deleting it to see that it actually was a file of something.)

  3. In the terminal/console/whatever you call it I did the following (typing it in manually):
    apt remove java-common
    wget https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz
    tar -xf openjdk-16.0.1_linux-x64_bin.tar.gz -C /opt/
    ln -s /opt/jdk-16.0.1/bin/java /usr/bin/java

  4. I tried starting a fresh minecraft server with the Minecraft version 1.17-rc1 and it worked perfectly.

End of edit.

Old post:
Hi.

General information about my skill level and OS

First of all, I am a noob. I’m not that experienced with Linux. I understand it somewhat, but there’s only the console and I’m used to Windows. I would love to learn how Linux works, but now I’m in a rush for the 1.17 release.
I use the MineOS Turnkey (Downloaded the ISO with Rufus and use it as the only OS).

I can’t start any of the Minecraftversions 1.17-preX or 1.17-rc1. Only versions before 1.17 works. So I searched for a solution and found this article, but something’s not working for me.
I did these steps:

apt remove java-common

wget https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_linux-x64_bin.tar.gz

tar -xf openjdk-16.0.1_linux-x64_bin.tar.gz -C /opt/

ln -s /opt/jdk-16.0.1/bin/java /usr/bin/java

However, the last command failed. I get this error message:
Failed to create symbolic link '/usr/bin/java': File exists

I googled it, and the only thing I learned is that it is like a shortcut.
I tried finding the file using FileZilla and if I try to delete it manually, it says:

Error: Directory /usr/lib/jvm/java-11-openjdk-amd64: no such file or directory Error: Failed to retrieve directory listing

Any idea?

Thanks in advance,
Opsi

1 Like

If this is helpful at all, this is how I have mine set up for MineOS Turnkey following @TomGMiner’s guide and @ctabone’s response. Thanks you too!

(trashy formatting incoming, was formatted for discord and reposted :laughing: )

1 Like

Hello, I am currently trying this for my TrueNAS jail and the line
“tar -xf openjdk-15.0.2_linux-x64_bin.tar.gz -C /opt/”
returns with
could not chdir to ‘/opt’

How can I fix this?

Thank you!

3 Likes

TrueNAS user here, as well.
If anyone else has TrueNAS/FreeNAS and can come up with a modified set of instructions, it would be greatly appreciated! Likewise, if I happen to find a modified set of instructions for TrueNAS/FreeNAS, I will be sure to post here.

2 Likes

Here is a solution for upgrading Java for MineOS on TrueNAS (FreeNAS)

Would like to point out, if your FTP denies you permission to delete your java file in /usr/bin you can run ‘chown -R name:name /usr/bin’ in ssh (with “name” being your username).

NOTE:

As of June 28, Java16 comes standard in the MineOS Turnkey ISO.