How to set environment variable JAVA_HOME that will be saved on exit?
Add to /etc/profile.local
:
export JAVA_HOME=/usr/java/latest
That way it will be set for all users and will be independent of the release or patch-number. /usr/java/latest
is a link to the latest installed version and exists since JDK/JRE 1.6
Set environment variables in ~/.profile
, e.g. by adding this line:
export JAVA_HOME=/usr/java/jdk1.7.0_05