Setting JAVA_HOME path
1.Open the .bash_profile using vi editor for the root user
2.Add the following environment variable in the file. The following is the code
snippet of .bash_profile. The highlighted code shows the declaration of
JAVA_HOME and PATH. export will add the JAVA_HOME and PATH to the system
parameter for every user login.
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ];then . ~/.bashrc
fi
# User specific environment and start-up programs
JAVA_HOME=/opt/jdk1.6.0_24
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME
unset USERNAME
3. Save the .bash_profile using the :wq command
4. Once you have saved the .bash_profile, then you have to logout and re-log
in to the environment to activate the changes using the following command:
su – username
su – root (as our user is root)