Installing Sun Java on Fedora 12 RedHat RHEL CentOS

Fedora Generic BannerIf you’re new to Fedora you’ll notice there are a few special cases with Fedora. #1, they do not ship any packages that are not within compliance with GPL and that means Sun Java.

In this tutorial I’ll show how you can install Sun Java (which can replace an openjdk installation).

Q: Why Would You Want Sun Java?
A: Well in my case there are some java based applications that do not work with OpenJDK (yet).

First you’ll want to download the latest Sun Java JRE, which at the time of this writing was 6 Update 18. You can download the latest JRE packages from http://java.sun.com/javase/downloads/index.jsp.
Sun Java

On this page you’ll choose your installation package:
For 32-Bit Installation choose Linux
For 64-Bit Installations choose Linux x64
Sun Java

After you’ve picked your package, agree to the license and click on “Continue”.
Note: Note you can sign up for their news letter if you wish.

The next page will be where you download the package. The package you’re looking at downloading is:

Java SE Runtime Environment 6u18
jre-6u18-linux-i586-rpm.bin

Sun Java
or on x86_64

Java SE Runtime Environment 6u18
jre-6u18-linux-x64-rpm.bin

Sun Java

You can either click on the .bin, or use the checkbox and utilize the sun download manager (I don’t see any reason to, as the size of the download is quite minimal at under 20MB).

Once download you will install the package with:
On x86

su -c ‘sh jre-6u18-linux-i586.rpm’

or
On x86_64:

su -c ‘sh jre-6u18-linux-x64-rpm.bin’

You’ll have to agree to the license by pressing q, then typing yes.

Some stuff will pop up, wham, bam then the installation process is done, but some further configurations are needed.

First lets make sure that Fedora will use Sun Java instead of OpenJDK which is done with the alternatives command:

su -c '/usr/sbin/alternatives --install /usr/bin/java java \
/usr/java/default/bin/java 20000'

Now you want to setup the Sun Java Plugin for your firefox browser:
For x86

su -c '/usr/sbin/alternatives --install \
/usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so \
/usr/java/default/plugin/i386/ns7/libjavaplugin_oji.so 20000'

For x86_64:

su -c '/usr/sbin/alternatives --install \
/usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 \
/usr/java/default/lib/amd64/libnpjp2.so 20000'

You can do the same for your Opera browser if you wish:
For x86

su -c '/usr/sbin/alternatives --install \
/usr/lib/opera/plugins/libjavaplugin.so libjavaplugin.so \
/usr/java/default/plugin/i386/ns7/libjavaplugin_oji.so 20000'

For x86_64:

su -c '/usr/sbin/alternatives --install \
/usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 \
/usr/java/default/lib/amd64/libnpjp2.so 20000'

Note: The \’s indicated in the above commands are to break the line. If you are typing it yourself, you can type it without the \ as a single line installation, or just copy and paste the above into your terminal.

After you setup the browser plug-ins you’ll have to close your browser.

To verify your plug-in are being used by your browser type: about:plugins in the address bar to get a screen like so:
Sun Install

About ben.kevan

I am ben kevan.. Well yeah. .that's about it. More Posts

3 Comments to “Installing Sun Java on Fedora 12 RedHat RHEL CentOS”

  1. Nick Fenwick // April 25, 2010 at 6:57 pm //

    Nice list, but you seem to have missed out the final “alternatives config java” step to actually select the newly installed JRE. Without this, the old one will still be selected.

    $ /usr/sbin/alternatives –config java

    Your java plugin for Firefox is also rather out of date, or confused. Presuming you’re on Firefox 3.6 or later, it should be libnpjp2.so for i386 as well as x64:

    /usr/sbin/alternatives –install /usr/lib/firefox-3.6/plugins/libnpjp2.so libnpjp2.so /usr/java/jdk1.6.0_20/jre/lib/i386/libnpjp2.so 20000

    (note, I’ve used the /usr/java path that the sun -rpm.bin installed to on my Fedora Core 12 system)

    You may also refer to another howto: http://www.if-not-true-then-false.com/2010/02/howto-install-sun-java-jdk-jre-on-fedora-centos-red-hat/

    Your mileage may vary :)
    Nick

  2. Nick Fenwick // April 25, 2010 at 6:59 pm //

    Oh, and set the java plugin via alternatives, also:

    $ /usr/sbin/alternatives –config libnpjp2.so

    and select the one you’ve just installed. My old 1.6.0.16 was still selected, after installing the 1.6.0_20 option as in my previous comment.

    Nick

  3. Great goods from you, man. I’ve remember your stuff prior to and you are just extremely magnificent. I actually like what you’ve acquired here, really like what you are stating and the way in which in which you are saying it. You make it enjoyable and you still take care of to stay it wise. I can not wait to read far more from you. This is actually a wonderful website.

Leave a comment

Your email address will not be published.

*