On Sun, Aug 07, 2005 at 05:54:16PM -0500, Jay Leafey enlightened us:
I don't know if this is much use, but here's the command I used to add the Sun JDK to alternatives after I installed the RPM (look out for line wrap):
alternatives \ --install /usr/bin/java java /usr/java/jdk1.5.0_04/jre/bin/java 10 \ --slave /usr/bin/rmiregistry rmiregistry \ /usr/java/jdk1.5.0_04/jre/bin/rmiregistry \ --slave /usr/lib/jvm/jre jre /usr/java/jdk1.5.0_04/jre
This sets all of the slaves except jre_exports, which I could not seem to find in the Sun JDK. Anybody got any ideas on what this should actually point to?
Anyway, I then used the command 'alternatives --set java /usr/java/jdk1.5.0_04/jre/bin/java' to switch over to using the Sun Java. Heres what the alternatives output looks like afterwards:
[root@jaybird ~]# alternatives --display java java - status is manual. link currently points to /usr/java/jdk1.5.0_04/jre/bin/java /usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420 slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj slave jre: /usr/lib/jvm/jre-1.4.2-gcj /usr/java/jdk1.5.0_04/jre/bin/java - priority 10 slave rmiregistry: /usr/java/jdk1.5.0_04/jre/bin/rmiregistry slave jre_exports: (null) slave jre: /usr/java/jdk1.5.0_04/jre Current `best' version is /usr/lib/jvm/jre-1.4.2-gcj/bin/java. [root@jaybird ~]# java -version java version "1.5.0_04" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05) Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
The reason the GCJ version shows up as the 'best' is because it has a higher priority (1420) than the Sun version (10). Just change the priority in the 'alternatives --install' command listed above to something higher than 1420 and the Sun version will become the 'best' version.
Just my $.02.
The jpackage.org folks take things even further. Check their spec file, but it results in:
[hyclak@euclid ~]$ /usr/sbin/alternatives --display java java - status is auto. link currently points to /usr/lib/jvm/jre-1.5.0-sun/bin/java /usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420 slave keytool: (null) slave orbd: (null) slave policytool: (null) slave rmid: (null) slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry slave servertool: (null) slave tnameserv: (null) slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj slave jre: /usr/lib/jvm/jre-1.4.2-gcj slave java.1.gz: (null) slave keytool.1.gz: (null) slave kinit.1.gz: (null) slave klist.1.gz: (null) slave ktab.1.gz: (null) slave orbd.1.gz: (null) slave policytool.1.gz: (null) slave rmid.1.gz: (null) slave rmiregistry.1.gz: (null) slave servertool.1.gz: (null) slave tnameserv.1.gz: (null) /usr/lib/jvm/jre-1.5.0-sun/bin/java - priority 1503 slave keytool: /usr/lib/jvm/jre-1.5.0-sun/bin/keytool slave orbd: /usr/lib/jvm/jre-1.5.0-sun/bin/orbd slave policytool: /usr/lib/jvm/jre-1.5.0-sun/bin/policytool slave rmid: /usr/lib/jvm/jre-1.5.0-sun/bin/rmid slave rmiregistry: /usr/lib/jvm/jre-1.5.0-sun/bin/rmiregistry slave servertool: /usr/lib/jvm/jre-1.5.0-sun/bin/servertool slave tnameserv: /usr/lib/jvm/jre-1.5.0-sun/bin/tnameserv slave jre_exports: /usr/lib/jvm-exports/jre-1.5.0-sun slave jre: /usr/lib/jvm/jre-1.5.0-sun slave java.1.gz: /usr/share/man/man1/java-java-1.5.0-sun.1.gz slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.5.0-sun.1.gz slave kinit.1.gz: /usr/share/man/man1/kinit-java-1.5.0-sun.1.gz slave klist.1.gz: /usr/share/man/man1/klist-java-1.5.0-sun.1.gz slave ktab.1.gz: /usr/share/man/man1/ktab-java-1.5.0-sun.1.gz slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.5.0-sun.1.gz slave policytool.1.gz: /usr/share/man/man1/policytool-java-1.5.0-sun.1.gz slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.5.0-sun.1.gz slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.5.0-sun.1.gz slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.5.0-sun.1.gz slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.5.0-sun.1.gz Current best' version is /usr/lib/jvm/jre-1.5.0-sun/bin/java.
Matt