

update-java-alternatives - list Code language: PHP ( php ) The best way to see the installed Java path is to use the following command. Get the List of Installed Java in your Ubuntu Machine To set up the path you need to figure out the path of the installed Java on your machine. Without JAVA_HOME many of the tools or packages will not work, such as Maven. Set Java Home Variable JAVA_HOME in UbuntuĪfter installing Java on any machine, you must set up the JAVA_HOME.

See the next block to see how to get the JAVA_HOME path for Java 14. # sudo apt- get install openjdk-11-jdk Code language: JavaScript ( javascript ) The command to install Java 14 on Ubuntu is as follows. But just for the sake of SEO, let me add one more block for Java 14 as well. Until now, you guys must have realized that you simply need to change the number in the command openjdk-_jdk, and you can install the desired version. The JAVA_HOME path for Java 11 is shown in the last block of this post. sudo apt- get install openjdk-11-jdk Code language: JavaScript ( javascript ) And you will get the following command to install Java 11 on Ubuntu. Install Java 11 on Ubuntuįor Java 11 the process is the same. How to get the JAVA_HOME path for Java 8 is described in the last block of this post. Then wait for a few minutes until it gets installed. It will ask for confirmation, simply type and press y, and hit enter. sudo apt- get install openjdk-8-jdk Code language: JavaScript ( javascript ) To install Java 8 in Ubuntu, you need to run the following command. sudo apt- get update & sudo apt- get upgrade -y Code language: JavaScript ( javascript ) Install Java 8 on Ubuntu So keep in mind, whenever I say Java, in this post, I will be referring to the JDK.īefore installing make sure to update the repositories with the following.

If you install JRE then you can only run the Java programs and not compile them. For the Windows user, I have already written a post on “ Install Latest or Any Java Version in 3 Simple Steps: Windows“.Īs you might know, for us developers to develop Java programs, we need JDK and not only JRE. I will be installing Open JDK, and I will show the installation for JDK 8, JDK 11, and JDK 14 on Ubuntu.
