[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Why can't I select the Sun Java VM ?



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]