Thursday, February 19, 2009

Upgrading Java on RHEL


So you needed to upgrade Java on your Red Hat Linux, you've downloaded the RPM, installed and made sure all is well, but when you ran "java -version" you found out that your Linux is still pointing to the old version, This is what happened to me. After some Googling I found the answer, installing the new java version is not enough, you need to go through another step in order to tell the environment which JRE it should use..

run:

sudo /usr/sbin/alternatives --config java
This will open a menu which will prompt you to select the JRE\JDK folder you would like to use:

There are 3 programs which provide 'java'.

Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
+ 2 /opt/jre1.6/bin/java
In case your new installed version does not appear in the list add it using:

/usr/sbin/alternatives --install /usr/bin/java java /<Path to your new JRE>/bin/java
Select it and run "java -version" again to make sure you're upgraded.



No comments: