Tuesday, September 8, 2015

How to set java home in Linux

Open terminal on Linux box

Type the following commands.
Please note change the directory names as per your machine

export JAVA_HOME=/opt/java/jdk1.7.0_79/   
export JRE_HOME= /opt/java/jdk1.7.0_79/jre    
export PATH=$PATH:/opt/java/jdk1.7.0_79/bin:/opt/java/jdk1.7.0_79/jre/bin

Alternatively goto user home directory ( /home/oracle)

Type ls -a

This will list the .bash_profile file

open the .bash_profile using  vi  .bash_profile

add the following lines to .bash_profile

export JAVA_HOME=/opt/java/jdk1.7.0_79/   
export JRE_HOME= /opt/java/jdk1.7.0_79/jre    
export PATH=$PATH:/opt/java/jdk1.7.0_79/bin:/opt/java/jdk1.7.0_79/jre/bin

save the file

Now source the ./bash_profile

source .bash_profile

No comments:

Post a Comment