This page was last modified: December 07 2007 23:23:35   
Too Cool for Internet Explorer

Installing Sun's Java (JRE)

Fedora comes with a free Java implementation called IcedTea. If for some reason you want the one from Sun instead, this is the way to go:

First install these two libraries:

# yum install compat-libstdc++-33
# yum install compat-libstdc++-296

Run ldconfig (what is ldconfig?)

# /sbin/ldconfig

Download the JRE from Sun's website. Make sure you choose the Linux self-extracting file (not the RPM): http://www.java.com/en/download/linux_manual.jsp

Move your download to the /opt folder:

# mv jre-6u3-linux-i586.bin /opt/

Make the file executable and install it:

# cd /opt/
# chmod a+x jre-6u3-linux-i586.bin
# ./jre-6u3-linux-i586.bin

(use the spacebar to go through the license agreement, and type 'yes' (without the quotes) when you reach the end.

Register the plugin with firefox:

# ln -s /opt/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/lib/mozilla/plugins/libjavaplugin_oji.so
# ln -s /opt/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/lib/firefox-2.0.0.10/plugins/libjavaplugin_oji.so

If you also want to use Sun's Java with Java Applications, do the following:

With you favorite text editor, create the file /etc/profile.d/java.sh with the following two lines:

export JAVA_HOME=/opt/jre1.6.0_03
export PATH=$JAVA_HOME/bin:$PATH

...then...

# source /etc/profile.d/java.sh # /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java

Enter to keep the current selection[+], or type selection number: 

DO NOT ENTER A NUMBER, JUST PRESS [CTRL]+[C]

The information you got said that there a two programs that provides 'java', this number must now be increased by one. Then do the following:

# /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.6.0_03/bin/java 3

Now let's run the configure command once again:

# /usr/sbin/alternatives --config java

There are 3 programs which provide 'java'.

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

Enter to keep the current selection[+], or type selection number:

Press 3 and then [enter].

You can check you java-version like this:

$ java -version

Since we just installed version 1.6.0_03, you should see something like this:

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)

If you get an error saying "xcb_xlib.c:50: xcb_xlib_unlock: Assertion 'c->xlib.lock' failed", you have encountered a current bug which makes Sun Java with the FC8 libX11. To get around this, do:

sed -i 's/XINERAMA/FAKEEXTN/g' /opt/jre1.6.0_03/lib/i386/xawt/libmawt.so

The same fix (applied to the appropriate file) might work for other proprietary JDKs.

Thanks to:

fedorasoved.org
mjmwired.net