More than one javas

Hello guys, a few months I was able to install all the java versions on my server and even could change between them using just the update-alternatives --config java.
The thing is that I reinstalled MineOS Turnkey cause my server was more laggy than usual and i decide it to reinstall, my problem now is that I cant remember how do I installed those java versions (java8,10,11,16,17,etc).
At this moment, I only was able to install 2 at the same time that are java 11 and 17. Does someone know how to install more versions of java at the same time? I need help because I like to play diferenta versions of minecraft.

PD: Sorry for my bad English.

PD2: Not interesting about downloading the java versions and making a kind nano on the server folder to use the correct java, that is not efficient.

Eyyy guys, soo, I already solved it and I will explain how in a baggy way.

First of all u must download the Java version that u want. (I’ll use the Java version 19 as an example)\

Second u will tar the zip/rar/tar with the next comand: tar xvf jdk-19_linux-x64_bin.tar.gz

Third U must move the directory to the next location: mv jdk-19.0.1/ /usr/lib/jvm/

Last Step and the most important is using this command:
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-19.0.1/bin/java 1911

The 1911 means the priority of the java version, u can put the number that u want, the larger the number, the more priority it will have.

Now, u can check by yourself using update-alternatives --config java that u already installed another version of java and u can choose the one that u like.

java -version for verification:

1 Like