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, and to achieve a configuration for lifelong 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=your/java/path
Path= $JAVA _home/bin: $PATH
Then edit the export statement, adding java_home at the end, as follows:
Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc java_home
Configuration complete, follow: 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.