- Login to your account and open the startup script file which is usually
~/.bash_profilefile (or can be.bashrcdepending on your envrionment settings)
$ vi ~/.bash_profile
In the startup script, set JAVA_HOME and PATHC shell:
setenv JAVA_HOME jdk-install-dir setenv PATH $JAVA_HOME/bin:$PATH export PATH=$JAVA_HOME/bin:$PATH
jdk-install-dir is the JDK installation director, which should be something similar to /usr/java/jdk1.8.0_45/bin/java
Bourne shell:JAVA_HOME=jdk-install-dir export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
Korn and bash shells:
export JAVA_HOME=jdk-install-dir export PATH=$JAVA_HOME/bin:$PATH
Type the following command to activate the new path settings immediately:
$ source ~/.bash_profileVerify new settings:
$ echo $JAVA_HOME$ echo $PATH