Configure Java home variables in Linux, and if you search the Web, most of the answers you might find are:
Export Java Home=your/java/path
The problem is that the variable set in this way is only valid for the current user's current session, if you open another shell to execute:
Echo $Java Home
The results shown are still null values. When you turn on the next time you have to reset, so it is not recommended to use this method, so you want to configure Java home variables for Linux, and to implement a configuration lifetime use only need to follow the method configuration can:
Open the/etc/profile file as root, and locate this line similar to the following:
Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc
Insert the following on it:
Java Home=/home/loocao/software/java/jdk1.6.0_13
JRE_HOME=$Java Home/jre
CLASSPATH=.:$Java Home/lib:$JRE_HOME/lib:$CLASSPATH
PATH=$Java Home/bin:$JRE_HOME/bin:$PATH
Then edit the export statement and at the end add Java home, as follows:
Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc Java Home CLASSPATH jre_home
Configuration complete, follow the java-version command test.
Note: The computer needs to be restarted before it can take effect.
Variables configured in this way are valid for all local users, and different users do not need to repeat the settings.