The easiest way to install JDK in Linux
I have read lots of user posting at various pages and none of them would work.
Finally, I found a way to do this correctly and hope this will help to some of you.
Follow the simple steps:
1. To set the environment variables :
echo ‘export JAVA_HOME=/opt/btel/java/jdk1.5.0_16′ > /etc/profile.d/jdk.sh
echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile.d/jdk.sh
2. You have to source the file you just created by typing:
source /etc/profile.d/jdk.sh
3. Test if Java environment is successfully installed by typing in this in the shell:
java -version
You can just introduce a variable ORIG_PATH, to keep you path clean. Even after changing verrsion of (java) or anyother utility. By keeping all those in a single file.
$ cat /etc/profile.d/jdk.sh
JAVA_HOME=/opt/btel/java/jdk1.5.0_16
export JAVA_HOME
if [ ""$ORIG_PATH"" = """" ]; then
export ORIG_PATH=$PATH
fi
PATH=$JAVA_HOME/bin:$ORIG_PATH
Neo
December 21, 2008 at 4:47 pm
Ok thanks
adpjhype
December 24, 2008 at 1:35 pm
Thank you so much for sharing. I just installed jdk1.6.0_11 on my Fedora linux machine.
Peter
February 1, 2009 at 4:17 pm