Update: We’ve written a new guide for installing JRE 6. Please visit “Update on installing JRE 6 on CentOS“!
On our task to install the latest Java on our CentOS 5 machine we encountered that simply running the RPM from Sun’s Website is not enough. Here are the steps that we did to get Java installed properly.
- Get the latest JRE from SUN and download the RPM.
- Once done issue “chmod a+x” on the RPM.
- Then simply use “./jrexxxx” (the filename of the RPM) and let it run. This will install the JRE in /usr/java/jre1.6.0_04/bin/java.
You now expect that the latest JRE is installed, right? Alas, it is not so. You are still getting the default Java installation:
# java -version
java version “1.4.2_06″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
Looking around a bit we found that the path “/usr/bin/java” is a symbolic link pointing to the default Java location. So all you have to do now is to remove the existing symbolic link and create a new one to our JRE 1.6.0 installation. This is done with:
ln -s /usr/java/jre1.6.0_04/bin/java /usr/bin/java
When you now check on the version you should get the new Java version.
# java -version
java version “1.6.0_04″
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

