Using Sun’s JDK rpm on CentOS/RHEL

June 29, 2009 by: Phil Lembo

Up until recently it was my practice to download the Linux version of Sun’s JDK, do a “tar -czf” against it and then run the alternatives command to set up the links.

Since returning to CentOS from Ubuntu I decided to give the Sun rpm a try instead. The basic process was the same, the main difference being that by default Sun now creates a /usr/java/jdk-[version] directory with the JDK distribution in it and two symlinks. The aforementioned JDK directory is symlinked to /usr/java/latest/usr/java/default.

When running alternatives what I’ve been doing is to specify /usr/java/default/bin/java for the java executable, like this:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/default/bin/java 300

and then select the new install when configuring:

/usr/sbin/alternatives --config java
There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
 + 2           /usr/java/default/bin/java

For desktop machines the only remaining task is symlinking the Java plugin from /usr/java/default/jre/plugin/i386/ns7 to /usr/lib/mozilla/plugins.

Comments are closed.