A large number of Java-based programs require Java Runtime Environment (JRE) to run smoothly regardless of operating systems. For development purposes, most IDEs like Eclipse and NetBeans require Java Development Kit (JDK) installed on the machine. Whether you are a newbie developer looking forward to learning development or perhaps an application you have installed requires you to have Java installed on your system, we have you covered. Setting up of JAVA_HOME path is quite easy.
In this tutorial we are going to see How to setup java path in ubuntu
Step 1 : Install OpenJDK on Ubuntu
Install OpenJDK 14 using following command
sudo apt install openjdk-14-jdk
Step 2 : Setting the path Open a terminal Open “profile” file using following command:sudo gedit /etc/profile
step 3: find the path /usr/lib/jvm inside the file Find the java path in /usr/lib/jvm. Step 4: you will see something like followig If it’s JDK 14 the java path would be something similar to /usr/lib/jvm/java-14-oracle Stpe 5: Insert the following lines at the end of the “profile” fileJAVA_HOME=/usr/lib/jvm/java-7-oracle PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATH
Save and close the file. Step 6 : Type the following command:source /etc/environment
You may have to restart the system Step 7: Check whether JAVA_HOME is properly set with following command:echo $JAVA_HOME.
If it’s properly set, /usr/lib/jvm/java-14-oracle would be displayed on the terminal. Thanks for reading!! if you have any question please ask in a commnet.