RedHat by default supplies GNU Java tools (GJC). The IBM JDK or the BEA JDK are in the "extra" channel. But what if you want to use the Sun JDK...
Current licensing (2007/05) doesn't allow Sun JDK to be distributed by RedHat. (Maybe this will change with openJava?) Fortunately RedHat is actively involved with JPackage which makes it fully JPackage compatible! (hooray!)
If you use this guide, then the entire system will end up using the Sun JDK. So also a Tomcat that is installed with RH packages will use it (after a restart).
Installation of the Sun JDK is as easy as:
[see http://www.jpackage.org/installation.php\]
check the current java(c) version:
No Format |
---|
$ java -version
|
[probably the GNU one]
No Format |
---|
$ javac -version
|
[probably the Eclipse Java Compiler]
- get the latest Sun JDK RPM:
Choose the latest JDK; accept the agreement; download the JDK RPM-in-bin.No Format $ cd /root $ links http://java.sun.com/javase/downloads/index.jsp
- Make the binary executable and run it:
The rpm is extracted from the bin and installed (accept the license).No Format $ chmod u+x <java-jdk-bin> $ ./<java-jdk-bin>
The java version is now installed in /usr/java/.
This dir contains all individual versions and two symlinks: "latest" and "default". - Get the matching JPackage compatibility package for this Sun JDK:
No Format $ links ftp://jpackage.hmdc.harvard.edu/JPackage/1.7/generic/RPMS.non-free/
- To make the Sun java the default for the entire system, use the 'alternatives' method:
[select the Sun version instead of the GNU version for each of these commands]No Format $ /usr/sbin/alternatives --config java $ /usr/sbin/alternatives --config javac
check using:
$ java -version
[should be the new Sun version]
$ javac -version
[should be the new Sun version]
(optional)
Make Tomcat run on this JDK now:
$ /etc/init.d/tomcat5 restart