Saturday, 21 May 2011

Install Java

Uninstall OpenJDK or other JDKs you might have
Unless you need to have more JDKs (or you believe you do), please remove them now.
If the command java returns something decent than you have something already installed.


Download
Go to: http://www.oracle.com/technetwork/java/javase/downloads/index.html and choose your preferred version (i586 / x64).
When I was writing this post, the latest version was 6u25.
(Java version names are really stupid, normally this would be called 1.6.0.25).
I chose the x64 version :)

wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin 
You will download a file with a very long name.
You don’t really need to know it.
Just type “mv jdk” and then <tab> and then continue with “ /opt jdk-6u25-linux-x64.bin”.
You will get something like:
mv jdk-6u25-linux-x64.bin?longUselessStory /opt/jdk-6u25-linux-x64.bin

Install 
mkdir /usr/java
cd /usr/java
sh /opt/jdk-6u25-linux-x64.bin


Set JAVA_HOME
Edit /root/bash_profile (vi, Midnight Commander editor, whatever) 
JAVA_HOME=/usr/java/jdk1.6.0_25
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

Test Java
 java -version
You should get something that includes "Java(TM) SE Runtime Environment (build 1.6.0_25-b06)"

No comments:

Post a Comment