On RedHat you can add files to your /etc/profile.d directory.
add two files something like these:
javaProfile.csh
javaProfile.sh
the file javaProfile.sh contains (update for your directory structure):
Code:
# Java initialization script (sh)
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME="/usr/java/jdk_latest"
PATH=$PATH:"/usr/java/jdk_latest/bin"
fi
export JAVA_HOME
export PATH
#javaProfile.sh
the file javaProfile.csh contains (update for your directory structure):
Code:
# Java initialization script (csh)
if ( $?JAVA_HOME ) then
exit
endif
setenv PATH $PATH:/usr/java/jdk_latest/bin
setenv JAVA_HOME /usr/java/jdk_latest
These files are owned by root:root and permissions are set to 755