How to Set JAVA_HOME Path in Ubuntu 18.04 and 20.04 LTS


Java-based projects require Java Runtime Environment (JRE) to run easily paying little heed to working frameworks. For advancement purposes, most IDEs like Eclipse and NetBeans require Java Development Kit (JDK) introduced on the machine. Regardless of whether you are a novice designer anticipating learning advancement or maybe an application you have introduced expects you to have Java introduced on your framework, we have you covered. Setting up of JAVA_HOME way is very simple.


In this post, We will install Java and set Java_Home Path in Ubuntu 18.04/20.04 LTS.


Step 1: Update and Upgrade the System


You need to execute the given command to update the current ubuntu repository and update the default installed packages.


$ sudo apt-get update
$ sudo apt-get upgrade -y


Step 2: Install OpenJDK


You need to use the given command to install OpenJDK in ubuntu by following the given command.


To Install OpenJDK 8

$ sudo apt install openjdk-8-jdk -y 

To install OpenJDK 11

$ sudo apt install openjdk-11-jdk -y

To install OpenJDK 14

$ sudo apt install openjdk-14-jdk -y 


Step 3: Set JAVA_HOME Path in Ubuntu


Now we need to follow the given command to Set the “JAVA_HOME” and “PATH” environment variables on ubuntu machine.

$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

After that you need to verify the JAVA_HOME by using the given command.

$ echo $JAVA_HOME   


In this post, We have Install and set JAVA_HOME path on ubuntu 18.04/20.04 LTS server, Still you have any question, Please leave a comment. 


How to Set JAVA_HOME Path in Ubuntu 18.04 and 20.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top