Install Sun JDK on Linux

I’ve tested this procedure on Fedora 10 and Ubuntu 9.04 but it should work on other distributions too.

First of all download the latest JDK package from the SUN page: be sure to download the bin file and not the rpm.

From now on you’ll need to run commands using sudo.

Move the package to /opt/ and make it executable.

cd /path/to/download/folder

mv jdk-versionnumber-linux-i586.bin /opt/

cd /opt/

chmod +x jdk-versionnumber-linux-i586.bin

Now start the installation and follow the onscreen instructions

./jdk-versionnumber-linux-i586.bin

When the installation is done you’ll need to set the JAVA_HOME enviroment variable and add java executable to the system pah.

Open the file /etc/profile and add the following lines

JAVA_HOME="/opt/jdk_versionnumber"

export JAVA_HOME

PATH=$PATH:/opt/jdk_versionnumber/bin/

export PATH

Now add a symbolic link for the java command

ln -s /opt/jdk_versionnumber/bin/java /usr/bin/java

Log off and log in back and you’re done.