# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command ----------------------------------------------- * 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java + 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
So it thinks I have 2 versions of Java.
Here is the first:
# java -version java version "1.6.0_0" IcedTea6 1.4 (6b12-Fedora-10) Runtime Environment (build 1.6.0_0-b12) OpenJDK Server VM (build 10.0-b19, mixed mode)
Here is the second:
# java -version java version "1.5.0" gij (GNU libgcj) version 4.3.2 20081105 (Red Hat 4.3.2-7)
However, I actually have 3 versions of Java, because I installed the Sun Java from a Sun rpm:
# rpm -ql jre /usr/java/jre1.5.0_15/CHANGES /usr/java/jre1.5.0_15/COPYRIGHT /usr/java/jre1.5.0_15/LICENSE /usr/java/jre1.5.0_15/README /usr/java/jre1.5.0_15/THIRDPARTYLICENSEREADME.txt /usr/java/jre1.5.0_15/Welcome.html /usr/java/jre1.5.0_15/bin /usr/java/jre1.5.0_15/bin/ControlPanel /usr/java/jre1.5.0_15/bin/java
If I test it it works fine.
# /usr/java/jre1.5.0_15/bin/java -version java version "1.5.0_15" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04) Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)
So I move it to /usr/lib/jvm and run again:
alternatives --config java
There are 2 programs which provide 'java'.
Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
The Sun Java doesn't show up.
/usr/lib/jvm looks like this:
ls -al total 204 drwxr-xr-x 5 root root 4096 . drwxr-xr-x 183 root root 139264 .. drwxr-xr-x 3 root root 4096 java-1.5.0-gcj-1.5.0.0 drwxr-xr-x 3 root root 4096 java-1.6.0-openjdk-1.6.0.0 lrwxrwxrwx 1 root root 21 jre -> /etc/alternatives/jre lrwxrwxrwx 1 root root 27 jre-1.5.0 -> /etc/alternatives/jre_1.5.0 drwxr-xr-x 7 root root 4096 jre1.5.0_15 lrwxrwxrwx 1 root root 26 jre-1.5.0-gcj -> java-1.5.0-gcj-1.5.0.0/jre lrwxrwxrwx 1 root root 27 jre-1.6.0 -> /etc/alternatives/jre_1.6.0 lrwxrwxrwx 1 root root 30 jre-1.6.0-openjdk -> java-1.6.0-openjdk-1.6.0.0/jre lrwxrwxrwx 1 root root 25 jre-gcj -> /etc/alternatives/jre_gcj lrwxrwxrwx 1 root root 29 jre-openjdk -> /etc/alternatives/jre_openjdk
How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ?
Thanks
On Sun, 30 Nov 2008 09:40:34 -0500 Linuxguy123 linuxguy123@gmail.com wrote:
How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ?
Somewhere out in the world is a package that actually adds the sun java to the alternatives system (the sun packages do not do that, which is why it doesn't show up).
Where this package is located is another question. I remember seeing it once, but I forget where that was.
http://rabbitbrush.frazmtn.com/sun-java-on-F8.html
is a page I just found with a quick google search, but it doesn't look like the one I'm remembering :-).
* Tom Horsley tom.horsley@att.net [2008-11-30 11:54]:
On Sun, 30 Nov 2008 09:40:34 -0500 Linuxguy123 linuxguy123@gmail.com wrote:
How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ?
Somewhere out in the world is a package that actually adds the sun java to the alternatives system (the sun packages do not do that, which is why it doesn't show up).
Where this package is located is another question. I remember seeing it once, but I forget where that was.
http://rabbitbrush.frazmtn.com/sun-java-on-F8.html
is a page I just found with a quick google search, but it doesn't look like the one I'm remembering :-).
I believe you're thinking of java-*-sun-compat packages from JPackage (mentioned on that page). The compat package depends on the RPM from Sun, and sets up the proper alternatives. Unfortunately, they haven't been updated for a while:
http://mirrors.dotsrc.org/jpackage/1.7/generic/non-free/RPMS/
Deepak
-- fedora-list mailing list fedora-list@redhat.com To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
Em Dom 30 Nov 2008, Linuxguy123 escreveu:
# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
- 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
- 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
So it thinks I have 2 versions of Java.
Here is the first:
# java -version java version "1.6.0_0" IcedTea6 1.4 (6b12-Fedora-10) Runtime Environment (build 1.6.0_0-b12) OpenJDK Server VM (build 10.0-b19, mixed mode)
Here is the second:
# java -version java version "1.5.0" gij (GNU libgcj) version 4.3.2 20081105 (Red Hat 4.3.2-7)
However, I actually have 3 versions of Java, because I installed the Sun Java from a Sun rpm:
# rpm -ql jre /usr/java/jre1.5.0_15/CHANGES /usr/java/jre1.5.0_15/COPYRIGHT /usr/java/jre1.5.0_15/LICENSE /usr/java/jre1.5.0_15/README /usr/java/jre1.5.0_15/THIRDPARTYLICENSEREADME.txt /usr/java/jre1.5.0_15/Welcome.html /usr/java/jre1.5.0_15/bin /usr/java/jre1.5.0_15/bin/ControlPanel /usr/java/jre1.5.0_15/bin/java
If I test it it works fine.
# /usr/java/jre1.5.0_15/bin/java -version java version "1.5.0_15" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04) Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)
So I move it to /usr/lib/jvm and run again:
alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
The Sun Java doesn't show up.
/usr/lib/jvm looks like this:
ls -al total 204 drwxr-xr-x 5 root root 4096 . drwxr-xr-x 183 root root 139264 .. drwxr-xr-x 3 root root 4096 java-1.5.0-gcj-1.5.0.0 drwxr-xr-x 3 root root 4096 java-1.6.0-openjdk-1.6.0.0 lrwxrwxrwx 1 root root 21 jre -> /etc/alternatives/jre lrwxrwxrwx 1 root root 27 jre-1.5.0 -> /etc/alternatives/jre_1.5.0 drwxr-xr-x 7 root root 4096 jre1.5.0_15 lrwxrwxrwx 1 root root 26 jre-1.5.0-gcj -> java-1.5.0-gcj-1.5.0.0/jre lrwxrwxrwx 1 root root 27 jre-1.6.0 -> /etc/alternatives/jre_1.6.0 lrwxrwxrwx 1 root root 30 jre-1.6.0-openjdk -> java-1.6.0-openjdk-1.6.0.0/jre lrwxrwxrwx 1 root root 25 jre-gcj -> /etc/alternatives/jre_gcj lrwxrwxrwx 1 root root 29 jre-openjdk -> /etc/alternatives/jre_openjdk
How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ?
You must register the new java alternative with the alternatives command first. Just type in as root in a terminal window: alternatives --install /usr/bin/java java /opt/jre1.6.0/bin/java 3 alternatives --config java
And select the one you want to be the default. Replace "/opt/jre1.6.0/bin/" with the path where you have decompressed Sun's java binaries. I've read a long time ago that we shouldn't install Sun's Java RPM in Fedora, because it would overwrite some files of GCJ. When you update GCJ the next time, it will overwrite back the Sun's files. I don't know for sure if this was correct or if it is still the case but maybe, just to be safe, you should download the non-rpm package from Sun and decompress it manually in /opt or other directory you like. If any one knows if it's still not recommended to install Sun's Java RPM package, please let us know.
[]'s Marcelo
On Sun, 2008-11-30 at 14:06 -0300, Marcelo Magno T. Sales wrote:
Em Dom 30 Nov 2008, Linuxguy123 escreveu:
# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
- 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
- 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
So it thinks I have 2 versions of Java.
Here is the first:
# java -version java version "1.6.0_0" IcedTea6 1.4 (6b12-Fedora-10) Runtime Environment (build 1.6.0_0-b12) OpenJDK Server VM (build 10.0-b19, mixed mode)
Here is the second:
# java -version java version "1.5.0" gij (GNU libgcj) version 4.3.2 20081105 (Red Hat 4.3.2-7)
However, I actually have 3 versions of Java, because I installed the Sun Java from a Sun rpm:
# rpm -ql jre /usr/java/jre1.5.0_15/CHANGES /usr/java/jre1.5.0_15/COPYRIGHT /usr/java/jre1.5.0_15/LICENSE /usr/java/jre1.5.0_15/README /usr/java/jre1.5.0_15/THIRDPARTYLICENSEREADME.txt /usr/java/jre1.5.0_15/Welcome.html /usr/java/jre1.5.0_15/bin /usr/java/jre1.5.0_15/bin/ControlPanel /usr/java/jre1.5.0_15/bin/java
If I test it it works fine.
# /usr/java/jre1.5.0_15/bin/java -version java version "1.5.0_15" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04) Java HotSpot(TM) Server VM (build 1.5.0_15-b04, mixed mode)
So I move it to /usr/lib/jvm and run again:
alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
The Sun Java doesn't show up.
/usr/lib/jvm looks like this:
ls -al total 204 drwxr-xr-x 5 root root 4096 . drwxr-xr-x 183 root root 139264 .. drwxr-xr-x 3 root root 4096 java-1.5.0-gcj-1.5.0.0 drwxr-xr-x 3 root root 4096 java-1.6.0-openjdk-1.6.0.0 lrwxrwxrwx 1 root root 21 jre -> /etc/alternatives/jre lrwxrwxrwx 1 root root 27 jre-1.5.0 -> /etc/alternatives/jre_1.5.0 drwxr-xr-x 7 root root 4096 jre1.5.0_15 lrwxrwxrwx 1 root root 26 jre-1.5.0-gcj -> java-1.5.0-gcj-1.5.0.0/jre lrwxrwxrwx 1 root root 27 jre-1.6.0 -> /etc/alternatives/jre_1.6.0 lrwxrwxrwx 1 root root 30 jre-1.6.0-openjdk -> java-1.6.0-openjdk-1.6.0.0/jre lrwxrwxrwx 1 root root 25 jre-gcj -> /etc/alternatives/jre_gcj lrwxrwxrwx 1 root root 29 jre-openjdk -> /etc/alternatives/jre_openjdk
How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ?
You must register the new java alternative with the alternatives command first. Just type in as root in a terminal window: alternatives --install /usr/bin/java java /opt/jre1.6.0/bin/java 3 alternatives --config java
Thanks for the reply Marcelo.
And select the one you want to be the default. Replace "/opt/jre1.6.0/bin/" with the path where you have decompressed Sun's java binaries. I've read a long time ago that we shouldn't install Sun's Java RPM in Fedora, because it would overwrite some files of GCJ.
Interesting.
When you update GCJ the next time, it will overwrite back the Sun's files. I don't know for sure if this was correct or if it is still the case but maybe, just to be safe, you should download the non-rpm package from Sun and decompress it manually in /opt or other directory you like. If any one knows if it's still not recommended to install Sun's Java RPM package, please let us know.
I wasn't aware of this. Maybe it the problem with my Eclipse install.
Linuxguy123 wrote:
# alternatives --config java ... How do I get the Sun java to be the default Java, without doing a 24 step build that Googling finds ? ...
Here is the command I came up with to add Sun's Java 1.5.0_16 as an alternative on Oracle Enterprise Linux 5.0 (a Red Hat derivative, which I guess makes it a cousin of Fedora 8^), based on the alternatives man page and some Googling:
# alternatives \ --install /usr/bin/java java /usr/java/jdk1.5.0_16/bin/java 1500 \ --slave /usr/lib/jvm/jre jre /usr/java/jdk1.5.0_16/jre/ \ --slave /usr/lib/jvm-exports/jre jre_exports /usr/java/jdk1.5.0_16/jre/lib/ \ --slave /usr/bin/rmiregistry rmiregistry /usr/java/jdk1.5.0_16/jre/bin/rmiregistry
Make appropriate adjustments for your particular version of Java. Then if you rerun
# alternatives --config java
it should provide you with the alternative you want. Select it and you should be all set.