Friday 9 May 2014

Enabling Java in Firefox on Linux

OK this just applies to my particular distribution - Mandriva 2011.0 - but it should be broadly similar for other versions.


Step 1 - Check for 32-bit or 64-bit Firefox

Type about:buildconfig in the Firefox address bar 

Underneath Build Platform you will either see "i686" for 32-bit or in my case "x86_64" for 64-bit.

Go to www.java.com and download the correct 32 or 64 bit version of the latest Java update.  In my case it comes in RPMs, so I can just download and install them.   Note that you should only be able to install either the 32-bit or 64-bit version, not both.  So if you accidentally install the 32-bit one, the 64-bit one won't install until you remove it.



Step 2 - Location of Java plugins

In my case these are in the folder /usr/java/In that folder are various sub-directories for each java update as I've installed them:

jre1.7.0_17, jre1.7.0_45, etc

As of writing, the latest is jre1.7.0_55

But helpfully Mandriva puts a symlink to the latest folder and calls it "latest".

So the folder /usr/java/latest/ is always the link to the last one I installed.  Within this folder is the folder "lib" and within that the folder "amd64" (or in the case of 32-bit, "i386").

Within this folder is the Firefox Java plugin - libnpjp2.so

 

Step 3 - The Firefox Plugin folder

Now then, there are two of these, one of which (if not both) will work. In fact they may be per-user and global. I don't know.  They are:

/usr/lib64/mozilla/plugins

(or /usr/lib/mozilla/plugins for 32-bit)

and:

/home/dave/.mozilla/plugins

Personally I use the one within my own home folder. A symlink of the Firefox Java plugin needs to be created here.



Step 4 - Creating the symlink

This is so easy.  Open a terminal as root, and execute the following commands:

cd /home/dave/.mozilla/plugins/
ln -s /usr/java/latest/lib/amd64/linnpjp2.so


That's it.  Done.  You shouldn't need to do that ever again, even if you install a later version of Java, because the symlink points to the "latest" folder, which in turn always points to the last installed version of Java.



Step 5 - Testing Firefox.

Restart Firefox and go to www.javatester.org

No comments: