Tuesday, February 5, 2008

HowTo: Simultaneous Install of Sun Java and Java IcedTea on Fedora

From Fedora OS, if you were trying to issue

# java -version

and it is giving you the below similar output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java version "1.5.0"
gij (GNU libgcj) version 4.1.2 20070925 (Red Hat 4.1.2-33)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and you wish to have the Sun's Java output version of
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

then read on.

How to make Sun Java's and Java IcedTea's java version co-exists without uninstalling one another?
How to install both Sun Java and Java IcedTea on Fedora 8?
How to use any of the two mentioned java binary versions anytime you need one of them?

From my old post, I have covered the details on how to install Sun's java rpm package on Fedora 8 OS covering the steps of removing a post installed or existing opensourced java-icedtea java version.

Here's how to install Sun Java and Java IcedTea both working on Fedora 8.

First, make sure both Java versions are installed from your Fedora 8 box. Follow respectively.
a. Install Java IcedTea on Fedora 8
b. Install Sun Java on Fedora 8

Now, to confirm which java binary is your default java binary, simply

# java -version

With Java from RedHat GNU, you should see similar lines like
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java version "1.5.0"
gij (GNU libgcj) version 4.1.2 20070925 (Red Hat 4.1.2-33)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For Sun Java, you should be see similar lines like
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Alternatively, this can be achieved with the same concept like so

# alternatives --config java

The above line would show you your default java binary version too.

Now, if you have installed Java Icedtea package first before Sun's Java, we would then assume that your default Java is from RedHat GNU. Thus, we need to inform Fedora 8 that we now have 2 java binary versions now available from the system.

This can be done by following these next steps.

# alternatives --install /usr/bin/java java /usr/java/jre1.6.0_03/bin/java 2

Verify and confirm that you have 2 java binary available and acknowledged by Fedora 8.

# alternatives --config java

should show you these lines with 1 as your default java.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
+ 1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
* 2 /usr/java/jre1.6.0_03/bin/java
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To change the default Java binary , simply
# alternatives --config java

and press 2 to select the Sun's Java version and hit Enter. To go back, simply issue the command again and press 1 to choose the default java binary. This concept also works with any other two existing binary from your system, say /usr/local/bin/vertito and /bin/vertito, gets.

Check your browser java plugin here.

I have not mentioned before that uninstalling Java IcedTea package from your Fedora 8 using yum would somehow uninstall Fedora Office applications as well, so be careful.

That's it, enjoy.

Related Articles
Sun Java Installation on Fedora 8 with Java IcedTea Uninstallation
Java IcedTea Installation on Fedora 8 using Yum or RPM

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy