Installing Java for a Newbie As a newbie to linux I was haveing a hard time figureing out how to set the java home. non oth the other directions I tried seem to work for me.
I found these instruction when I was trying to install java for another app. it's fail proof.
First install java from rpm or bin dist.
To set up the global variable JAVA_HOME and add the binary directory to the path can be done by adding scripts to the /etc/profiles.d directory.
Using your favourite editor, create /etc/profiles.d/java.sh and /etc/profiles.d/java.csh. These are respectively:
#!/bin/sh
# JAVA additions
JAVA_HOME=/usr/java/j2sdk1.4.2
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH
# End of .sh version
#!/bin/csh
# JAVA additions
if ( ! $?JAVA_HOME ) then
setenv JAVA_HOME /usr/java/j2sdk1.4.2
endif
if ( $?PATH ) then
setenv PATH $JAVA_HOME/bin:$PATH
else
setenv PATH $JAVA_HOME/bin
endif
# End of .csh version
Give the files the same ownership and permissions as other files in the directory.
Execute the .sh file just created to set up the correct environment for JAVA.
# source /etc/profile.d/java.sh
That's it for installing Java |