Upgrade Java JDK on CentOS RHEL 5.5

This guide will detail the upgrade of the Java Development Kit (JDK) on a Red Hat Enterprise Linux (RHEL) 5.54 and CentOS 5.5 operating system. This example is accomplished through the use of PuTTY and XMing.

In our example the following guide was used to install the original JAVA JDK.

Install Java and Set Environment Variables

Download JDK6
Note: The link will not work, it is a time limited link. You may be better off downloading the jdk-6u18-linux-i586-rpm.bin and put on another FTP account to simplify your wget statement.

# wget http://download.oracle.com/otn/java/jdk/6u18-b07/jdk-6u18-linux-i586-rpm.bin

Make the binary executable
 # chmod 755 jdk-6u18-linux-i586-rpm.bin 

Install the JDK6
 # ./jdk-6u18-linux-i586-rpm.bin 

Edit the /etc/profile
 # gedit /etc/profile 

Add variables to path

JAVA_HOME=/usr/java/default; export JAVA_HOME

Log out of terminal for changes to take effect.

 # exit 

Log into terminal to check for changes

 # java -version 

Upgrade Java

Download Java

# wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-i586-rpm.bin

Note: If the download should hang after it reads complete, manually stop the download. It worked for me.
Make the binary executable
 # chmod 755 jdk-6u25-linux-i586-rpm.bin 

Install the JDK6
 # ./jdk-6u25-linux-i586-rpm.bin 

Check for changes

 # java -version 


Revert to Older Java JDK

cd /usr/java
unlink /usr/java/latest
ln -s /usr/java/jdk1.6.0_18 /usr/java/latest

Delete Old Java JDK
If you want to delete the old version. Goto to /usr/java directory. In that directory was

Delete the version that you had just upgraded.