Instructions
- Set Java_home System-wide
- 1
Start a root terminal session and then change directories to THE/USR/LIB/JVM folder. If you prefer, you can also log on to your system as root.
- 2
Display the folder ' s contents by typing the following command at the Bash shell prompt and then pressing "Enter:"
Ls-l
The listing would show several symbolic links and a single folder that contains your Java package files. The Java folder installed on CentOS 7 systems could have a name resembling the following:
Java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
The full path to this folder, however, would be:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
Sponsored Links
- 3
Type the Bash shell Export command that would set the $JAVA _home variable to the JAVA folder's full path and then Press "Enter." Your command should resemble the following:
Export java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
If you type ' echo $JAVA _home ' (without the quotes) at the command line and press "Enter", the shell would display the Java_ HOME path. The path change would be lost if you reboot, however, unless add the change to the system profiles located in The/etc Folder.
- 4
Switch directories To/etc and then open the "profile" text file using a editor like Vi, Emacs or Nano. The profile text file contains System-wide bash shell commands, parameters and variable available to all users.
- 5
Scroll to a blank line near the bottom of the file, type the same Export command you entered at the shell prompt, save the File and then exit your editor. When you or another user logs on to a CentOS session, the Java_home variable'll be set.
Java_home for single Users
- 6
Launch the File Manager and then navigate to THE/USR/LIB/JVM folder. The file Manager should display the icons for one folder and several symbolic links.
- 7
Select the folder and then press "Ctrl-c" to copy it to the Clipboard. One item the Clipboard would contain is the full directory path to the Java folder.
- 8
As a normal, non-root user, launch Gedit and then open the ". Bash_profile" text file located in your Home folder. Settings included in the. Bash_profile is set every time you log on to your system.
- 9
Click a blank line near the bottom of the file and then press "Ctrl-v" to paste Java folder's full path. The pasted line should resemble the following:
File:///usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
To put the ' path in a ' format you can use, however, delete the ' file://' section. The result should resemble the following
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
- 10
ADD the Bash Shell Export command to the assigns of the path to $JAVA _home, save your changes, and then exit Gedit . The final path command in your. Bash_profile should resemble the following line:
Export java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64
- 11
Log out of your CentOS session and then log back on set the $JAVA _home variable to JAVA's current location.
Read more:http://www.ehow.com/how_8424526_set-java-home-centos.html
Instructions Set java_home System-wide