Home > computers > RHEL 6 for the Clueless: Sun Java

RHEL 6 for the Clueless: Sun Java

Sunday 16 January 2011 Leave a comment Go to comments

The bundled Open Java on RHEL is okay. It’s also painfully slow, particularly compared to the competition. Most people still call it Sun Java, though it’s now owned by Oracle. Because we have installed the development packages, we have the Open JDK (Java Development Kit) so we’ll have to replace it with Oracle’s JDK for Linux. This is so much faster, there simply is no comparison, at least on desktop applications. That would be things like Jedit (a java-based text editor), the Bible Desktop or “JSword” (java version of Crosswire’s Sword Project) and any number of java games.

Get the RPM for the Java Development Kit (JDK) from Oracle. On that page, scan downward from the big fancy icons and in the first box, you’ll see a button for “Download JDK” — click that. Use the drop-down list button to select “Linux.” Checkmark the box agreeing to the license, accept their cookies and click the red “Continue” button. From there is should be another page with two options. We are going to use the first one, which ends in “rpm.bin.” It’s a rather large package, so it may take awhile. Don’t try to install from your browser; it won’t work.

(Update: Please note there are significant problems with the latest version 1.7 from Oracle. It creates conflicts with almost every Java application currently in use, breaking Libre Office, for example. Stick with the latest update for 1.6 until the conflicts are fixed.)

Here we go with the commandline again — open Terminal and login as root. This is not a typical situation with RPM files. Once you are logged in as root, you’ll probably be in your user account Home, and the file is in Downloads, so go there:

cd Downloads

There is no reason you can’t install it from here, but you may eventually want to start moving stuff out of Downloads to reduce the clutter. You can create another folder inside your Home directory and name it whatever you like.

We’ll probably need to change the permissions on this file, but it almost never downloads as an executable binary, which it is. If you run ls -l and don’t see X’s in the file permissions, you’ll need to change them:

chmod u+x jdk-6u23-linux-i586-rpm.bin

Next, we install it:

sh jdk-6u23-linux-i586-rpm.bin

That sh command is simply an older and very standard terminal shell (environment), and the bin file has a wrapper around it written in a script which expects you to use that shell. You may or may not see a bunch of text about licensing, but if it comes up, simply hit the SPACE bar a few times until it runs out and type “yes” at the question prompt. It should install automatically from there. It will create a bunch of RPMs and other files, but the wrapper is supposed to run RPM for you.

Now let’s tell RHEL to start using this faster java. The command is rather obscure, and you’ll probably never see it again after we take care of this and the next item. It tells RHEL you want to switch among the alternative java environments on the system.

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000

Finally, we want Mozilla and any other browser in the system to use this new java. We use that “alternative” command one more time:

/usr/sbin/alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/default/jre/lib/i386/libnpjp2.so 20000

That’s all one line. Restart Mozilla and it should now be using your new java. Maybe someday the Open Java project will catch up and provide something closer to Oracle’s product. This particular process continues to be overly complicated to make it work right, and it shouldn’t be necessary.

As a final item before we close out the desktop portion of this series, I need to mention I found one critical package missing which did not get installed by default. Chances are you haven’t missed it yet, but you will later. The default system spelling checker is something called “hunspell” and the default dictionary for English didn’t get installed on my system. So while your Terminal window is still open, you need to do this:

yum install hunspell-en

If English is not your preferred language, you can always ask Yum what else is available:

yum search hunspell

Among the items listed should be something there you can recognize and use.

Categories: computers Tags: , ,
  1. Monday 31 January 2011 at 2:50 am

    Great Post. Thanks for sharing.

  2. Mike Kruger
    Friday 22 April 2011 at 6:42 pm

    Agreed…it’s more complicated than it should be. But with your help, it’s working great (including the Firefox Plugin). Also working in Google Chrome too. Thanks!

  3. Thursday 8 September 2011 at 12:31 am

    thanks for sharing… works like a charm…

  4. Sunday 8 January 2012 at 6:39 pm

    Thanks for sharing this. I found a slightly simpler mechanism (assuming the system has a current support contract).

    If you go into RHN, select the system, click on Software Channels and subscribe the system to ‘RHEL Server Supplementary’, you can then simply do a ‘yum install java-1.6.0-sun’.

  5. Sunday 8 January 2012 at 7:03 pm

    Thanks, Crispian. But for everyone using unsponsored RHEL, or CentOS and Scientific Linux, the manual hassle is all we have.

  1. Sunday 16 January 2011 at 6:52 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 495 other followers

%d bloggers like this: