Setting JAVA_HOME and JRE_HOME path

I am not sure about any other version of Linux, but in Ubuntu you need open home/.bashrc and add in the end of file

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64

export PATH=$JAVA_HOME/bin:$PATH

after that, save file and relogin.

EDIT

java will know where is jre by JAVA_HOME.


firstly try to get out of root user if possible than after that change below in your ~/.bash_profile

JAVA_HOME=/usr/java/<Java version 7 jdk>; export JAVA_HOME // you can also try JAVA_HOME=/usr/java/jdk 7 version/bin/java
PATH=$JAVA_HOME/bin:$PATH; export PATH

save it and then

now source ~/.bashrc

after that try

echo $JAVA_HOME it will produce the expected result.

Tags:

Java