How to update java?

So I am still fairly new to Truenas Scale and have been able to fumble around a bit and get things working. But for some reason I can not find any useful links on how to update to the newest version of Java so my kids can play the newest version of MC. I am using MineOS from the apps page it is installed and running no problems at all there. When we run the older versions they run and run great. But with the two newest releases they just won’t run because the Java version needs to be updated from what I can understand.

I have read countless hours on how to do this but everything I seem to run into seems to be for jail and core. Which I no longer run since the app support seems to be falling off. I am open to learning more about this system everyone loves it in the house. Any ideas and help would be greatly appreciated by my family. Thanks to all that take the time to replay in advance.

You could install Minecraft server directly into a sandbox on scale.

Like this:

Or you could directly use docker more like this:

I would install into a docker jail using jailmaker:

I would be surprised if the docker image didn’t use the latest jdk required.

Ok maybe it’s time for me to set up my test system and play around a bit more and see what all this can do before I commit to my main server setup. But I am still confused as how this is going to update the java data. I’ll watch the video again maybe I missed that info. This is good info I had no idea all this could be done. So it is helpful for future reference. Thanks for the input.

I am able to download the needed file from the shell but can’t seem to get it to install. Below is the information I am getting saying that they have disabled the sudo and apt functions. So I’m at a new road block for sure. Any thoughts or work arounds for this type of situation that won’t break everything?

> admin@truenas[~]$ wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
> 
> --2024-05-07 21:53:49--  https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
> Resolving download.oracle.com (download.oracle.com)... 23.203.28.113
> Connecting to download.oracle.com (download.oracle.com)|23.203.28.113|:443... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 167889048 (160M) [text/plain]
> Saving to: ‘jdk-21_linux-x64_bin.deb’
> 
> jdk-21_linux-x64_bin.deb                 100%[==================================================================================>] 160.11M  44.6MB/s    in 4.1s    
> 
> 2024-05-07 21:53:53 (39.0 MB/s) - ‘jdk-21_linux-x64_bin.deb’ saved [167889048/167889048]
> 
> admin@truenas[~]$ java --version
> zsh: command not found: java
> admin@truenas[~]$ sudo dpkg -i jdk-21_linux-x64_bin.deb
> 
> [sudo] password for admin: 
> Package management tools are disabled on TrueNAS appliances.

Truenas is an appliance OS, not a distribution really. In general, one shouldn’t update any packages on it. Use apps, jails, vms, whichever you want to use for any specific purpose, and load whatever version of anything you want.

Two options using jailmaker

  1. make a jail, install Minecraft and JDK according to the first set of instructions I linked

  2. make a docker jail, according to video I linked, then install Minecraft as a docker. 2nd link. Or another link you’d need to find for using compose.

None of these involves installing the jdk into the TrueNAS shell.

So after some rest that I clearly needed and your message it dawned on me I was going about this the wrong way. It’s not the OS these apps are using to pull Java or any other linked systems it’s going to be packaged into the Container and or jail and that’s where it is pulling that information in. I’ve been thinking in the terms of a common OS. Thanks for clearing that up.

1 Like

Ok so I took a differnt path. Now realizing what all was said. So now with the new information how does one update Java in a POD? I can’t seem to find a way to do so. I am also toying around with what you have posted before but keep running into the same issue. The Java is out of date for the newest releases. Thanks again.

The author of the app needs to update the app with a new java version.

To be honest that would be the best route. But as of right now no response or updates from the developer. So at this point I’m still looking for a work around. I was able to get into the pods shell and tinker around and do the java --version and it tells me the current version but doesn’t seem to let me update or upgrade the version. Is there any reason why this is that maybe I am not understanding? I am really trying to understand what exactly is happening with this POD system.

As far as I know these container images are immutable once deployed. Someone needs to create a new image with a higher version of java and upload that to the image repository.

You might want to take the jailmaker approach to get an independent installation of MineOS.

You can learn docker to do so and make your own container and deploy from it. No coding is needed, just docker knowledge. All my apps are my own crafted containers. You can extend the standard container, or, build your own. Mine all starts with the standard container and just add a few things to it.

1 Like

I for sure need to learn more about docker. I have just had a bit of education on it from what I am able to see on YT. I have had to give up on my current endeavors for now. I figured out how to update the POD to the newest version but still couldn’t figure out how to import and install the Java. I figured I would give my self a few days and then try again. I’m sure it’s something really dumb and easy I just haven’t had the lightbulb moment yet.

You cannot change a pod after the fact. You need to install a custom docker image so you create your own pod - or the author of that one updates it and uploads a newer image to dockerhub.

1 Like

PMH is correct, that’s not how docker works. To be able to use even the built in apps, it’s useful to know some thing about docker as well, it;s not a quick read. Specifically, dockerfile. Alternative is a jail.

Having just encountered this problem myself, I can say that it took some time to overcome, before I figured out that apt was installed in the docker.

Step 1: Open the MineOS docker shell
Step 2: run the command apt-get update
Step 3: run the command apt install wget
Step 4: run the command ‘wget https://download.oracle.com/java/22/latest/jdk-22_linux-x64_bin.deb
Step 5: run the command dpkg -i jdk-22_linux-x64_bin.deb

Edit: You’ll have to do this every time you re-start or update the server.

Thanks Dan for the catch.

…which will survive until the next time you update that app.

1 Like

True. . .but given the up time I’ve had on my apps, hasn’t been an issue. Should have mentioned that, though. Thanks!