Getting Java plugin + applets to work on Linux 64 bit

UPDATED:
Many folks out there are having a hard time getting their 64 bit Firefox browsers to run Sun Java plugin to do home banking via secure applets etc.

So, here comes a recipe that works (for me anyhow).

I use Ubuntu 8.10, but the procedure should not differ much on other distributions.

download the early access java jar file from sun from here:
http://download.java.net/jdk6/index.htmlhttp://download.java.net/jdk6/index.html

By the time of writing the direct url is this:

http://www.java.net/download/jdk6/6u14/promoted/b03/binaries/jre-6u14-ea-bin-b03-linux-amd64-10_mar_2009.jar

Make sure to download the 64 bit .jar for Linux!

Uninstall any Java versions you might have laying around, like openJDK, IcedTea plugin, GCJ etc..

Install a 64 bit version of the Sun JRE from standard repositories, to run the .jar file correctly, and execute the following command from the location of the .jar file:

sudo java -jar [path_to_jarfile you downloaded]

choose to install in /usr/lib/jvm/ from the GUI installer that pops up.
This gives you a new directory below /usr/lib/jvm, in this case /usr/lib/jvm/jre1.6.0_14/
now make all files in the new directory executable (as mentioned on Sun’s site):
sudo chmod +x /usr/lib/jvm/jre1.6.0_14/lib/amd64/*

then link the needed file to the right directory with the following command:

sudo ln -s /usr/lib/jvm/jre1.6.0_14/lib/amd64/libnpjp2.so /usr/lib64/mozilla/plugins/libnpjp2.so

This is intended for 64-bit Firefox, using the new plugin format from Sun.

Make sure to use complete file paths when creating symbolic links, or you will get a cyclical link referring back to itself, in other words, it wont work. (too many levels of symbolic links error)

Restart your browser and check with about:plugins in the url field, that the plugin is in fact installed! 😉

In Ubuntu the Java executable is referenced from /etc/alternatives/java, so we need to update the link to the new version:

sudo rm /etc/alternatives/java

Than we need to symlink the binary from the new installment:

sudo ln -s /usr/lib/jvm/jre1.6.0_14/bin/java /etc/alternatives/java

You can now check that the new version of Java is in use by the system by issuing:
java -version
From a terminal. This should now be:
Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b12, mixed mode)

That should be it!
Happy Java browsing.