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.
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:
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 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.
Ed Hurst is Associate Editor of Open for Business