Follow Our Previous Article based on How to install java 8 on redhat/CentOS Machine.

Check Out Installation Of Java 8 On Redhat/CentOs 7

Here, I’m going to show you how to set the path for java on linux machine. This is very important in order to run the java code or compile them.

Step 1 :

Location of java installation is /usr/java/

Now You will have to find a bashrc file

Step 2 : You can find that file by a command

Here you have to put these settings to set the java path

Go the file  vim ./ .bashrc

Step 3 : Put these lines in this file

Set path for jdk

export  JAVA_HOME=/usr/java/jdk1.8.0_171

export  PATH=$PATH:JAVA_HOME/bin

Step 4 : run this command to reload the bashrc  file

source  /root/.bash_profile

Step 5 : Verify java path has been properly set or not by command mentioned below

echo  “JAVA_HOME”

If path is set properly it will show you output otherwise it’s blank output.

Now JAVA path is set successfully You can see the output.

You’re done.



Please enter your comment!
Please enter your name here