Introduction

A lot of people seem to be have trouble getting the Java plugin to work with Mozilla. I have no idea why. It's always really worked for me. :) As such I figured I'd write a document on how I went about installing Sun's Java RE 1.4.2 on my system. This is not a definative guide by the way, but it works for me™ and so I hope it works for you.

Downloading the Java Runtime Environment (RE)

My system is a Debian 3.0 (woody) Linux box running on i386 architecture. If you're not running Debian then don't let that put you off. These instructions are general enough so that they should work on most distributions, and even though they don't use a package manager to do the install they shouldn't mess up your system. They didn't mess up mine. (No guarantees though... :)

Anyway, I downloaded Sun's Java RE 1.4.2 self extracting binary ([jp]) and went shopping. On returning I found that the 14MB self-extracting binary had finally downloaded and so I was ready to play. Joy. Please note that I did NOT grab the RPM.

(As a side note, the installation instructions for Java RE 1.4.0_01, 1.4.0_02 and 1.4.1 are very similar to these. If you are installing either of those then just substitute 1.4.0_01 and 1_4_0_01, 1.4.0_02 and 1_4_0_02 or 1.4.1 and 1_4_1 for 1.4.2 in the instructions as appropriate and you should be fine. No guarantees though. ;)

Next I read the instructions available on the web page. They are rather sparse but are somewhat useful. Once done, I performed the following operations:

mkdir /usr/local/java.sun
cd /usr/local/java.sun
sh ~/j2re-1_4_2-linux-i586.bin
ln -s j2re1.4.2 java.current
chmod -Rc g+rX,o+rX .

You may wish to edit /etc/profile (or your equivalent) so as to include /usr/local/java.sun/java.current/bin in your $PATH.

In addition to this you will also need the libstdc++-libc6.1-1.so.2 library. To see if you need it just run the ldd command on the plugin like so:

ldd /usr/local/java.sun/java.current/plugin/i386/ns610/libjavaplugin_oji.so

If you have the library, one of the lines in the output will look like this:

libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0x40164000)

If it says it's not found then you'll need to install it. Under Debian this simple. All you need to do is to run the following command line:

apt-get install libstdc++2.9-glibc2.1

It'll download and install it for you. If it's already installed then there's an issue and you might wish to try and reinstall the package via:

apt-get --reinstall install libstdc++2.9-glibc2.1

Then test it with the above ldd command. If it still says it's not found then you have issues outside the context of this document. Sorry.

Now, if all has gone well, you have Java RE installed and functional and are ready to utilise the plugin.

Installing the Java Plugin

Locally:

Doing a local plugin install is useful if you are the only user of your sytem and you tend to upgrade Mozilla a fair bit. It keeps your plugins out of the way of the Mozilla install directory which tends to get nuked on 'sea' installs.

mkdir ~/.mozilla/plugins
ln -s /usr/local/java.sun/java.current/plugin/i386/ns610/libjavaplugin_oji.so ~/.mozilla/plugins/

Globally:

This is a useful option when your system has many users using it but it has the downside that you MUST be careful when installing a new version of Mozilla as you may windup fragging your plugins install.

ln -s /usr/local/java.sun/java.current/plugin/i386/ns610/libjavaplugin_oji.so /usr/local/mozilla/plugins/

If you installed Mozilla via a .deb then the location of the plugins directory changes. Please use the line below instead.

ln -s /usr/local/java.sun/java.current/plugin/i386/ns610/libjavaplugin_oji.so /usr/lib/mozilla/plugins/

Special notes are available for the following: Galeon GCC 3.0+ users and users of the 20030615+ version of the Mozilla nightly

Testing the Install

You should now start Mozilla and go to the about:plugins page to check that all is well. If it is you'll see something like this:

Java(TM) Plug-in 1.4.2-b28

File name: libjavaplugin_oji.so

Java(TM) Plug-in 1.4.2
MIME Type Description Suffixes Enabled
application/x-java-vm Java Yes
application/x-java-applet Java Yes
application/x-java-applet;version=1.1 Java Yes
application/x-java-applet;version=1.1.1 Java Yes
application/x-java-applet;version=1.1.2 Java Yes
application/x-java-applet;version=1.1.3 Java Yes
application/x-java-applet;version=1.2 Java Yes
application/x-java-applet;version=1.2.1 Java Yes
application/x-java-applet;version=1.2.2 Java Yes
application/x-java-applet;version=1.3 Java Yes
application/x-java-applet;version=1.3.1 Java Yes
application/x-java-applet;version=1.4 Java Yes
application/x-java-applet;version=1.4.1 Java Yes
application/x-java-applet;version=1.4.2 Java Yes
application/x-java-applet;jpi-version=1.4.2 Java Yes
application/x-java-bean Java Yes
application/x-java-bean;version=1.1 Java Yes
application/x-java-bean;version=1.1.1 Java Yes
application/x-java-bean;version=1.1.2 Java Yes
application/x-java-bean;version=1.1.3 Java Yes
application/x-java-bean;version=1.2 Java Yes
application/x-java-bean;version=1.2.1 Java Yes
application/x-java-bean;version=1.2.2 Java Yes
application/x-java-bean;version=1.3 Java Yes
application/x-java-bean;version=1.3.1 Java Yes
application/x-java-bean;version=1.4 Java Yes
application/x-java-bean;version=1.4.1 Java Yes
application/x-java-bean;version=1.4.2 Java Yes
application/x-java-bean;jpi-version=1.4.2 Java Yes

If you do not see something like that then you have some other issue that you should look into. (Why yes, this IS the copout paragraph. :)

Although, to slightly copout of the copout paragraph, there WAS an issue with Mozilla on Linux and Java (from around mid-January 2003 till 20030205) in that it did not let Java init itself properly. Bug 189461 deals with the issue and provides the following workaround if you insist on running a version of Mozilla from that time period. In order to start it you'll need to do:

LD_PRELOAD=/usr/local/mozilla/libxpcom.so /usr/local/mozilla/mozilla &

Or some variation thereof. Java should then start fine for you. The better solution is to use a Mozilla build past 20030205. If it still does not then you probably have deeper issues. ;)

Anyway, I hope this helps you out. If you would like to add anything to this document (like extra information for other Linux distributions or instructions for other operatings) then please contact me. Thanks. :)

Oh. Feedback rocks. Send me lots of feedback. :)