Installing multiple JDK in Linux
Before we begin installing Java in our system, we should check if it is already installed or not. To do so we can run the below command in our terminal:
java -version
If Java is already installed in your system, it will print something like this:-
openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment (build 11.0.14+9-Ubuntu-0ubuntu2.22.10)
OpenJDK 64-Bit Server VM (build 11.0.14+9-Ubuntu-0ubuntu2.22.10, mixed mode, sharing)
if it’s not present already, it usually shows something similar to this:-
Command 'java' not found, but can be installed with:
sudo apt install openjdk-11-jre-headless
sudo apt install default-jre
sudo apt install openjdk-17-jre-headless
sudo apt install openjdk-8-jre-headless
sudo apt install openjdk-15-jre-headless
-------- maybe some more suggestions to install -------
Suppose java is not installed and you see the default suggestions given in the terminal output, you can notice here that the suggestions are only about installing selective versions of OpenJDK as the only vendor.
💡
What if you want to install any other version of Java?
What if you want the Java from different vendors?
What if you need to install & keep multiple Java versions same time?
This post has an answer to all your questions, keep reading…
Installing Java from OpenJDK
To install Java from OpenJDK, go to https://openjdk.java.net. This is the official website to download the Free OpenSource Java builds for all major platforms and is backed by a huge community and the Oracle team.
In the Download section, you will see a link pointing to the latest stable version of JDK. The link will be similar to jdk.java.net/17. Click on it. And you will be able to see the list of builds for major platforms.
You can click on the archive name to start the download process.
Bonus: Unlike Oracle’s commercial Java builds, here we don’t need to accept any terms & conditions.
Releted Posts
Listing files & directories in Linux
Listing files & directories in Linux/Unix-based systems is very easy. Also, there are some options that you may find useful in the day-to-day usage of Unix-based operating systems.
Read more