Ubuntu & Debian FIX java plugin for Firefox and Chrome

How to Fix java plugin in Ubuntu for Firefox/Chrome

The error:

Your browser Mozilla Firefox or Google Chrome refuses to execute a java applet because of the security risks related to an old version of java, most likely the jdk1.7.0_40 which has been disabled by Mozilla Firefox plugin mantainers on October the 16th. So you probably want to install jdk1.7.0_45.  Anyway, this said, this procedure will most likely work with following versions of Java, Firefox, Chrome, Ubuntu 🙂 And of course. if you need to install Java for your browsers or operating system and you haven’t yet installed once, just skip the parts with the “rm” command as the rest is the same.

Download and install the Jdk

First of all download the latest version of java from the oracle website:

from this page http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html , download either jdk-7u45-linux-x64.tar.gz OR jdk-7u45-linux-i586.tar.gz; which one of the two versions depends on your operating system.

Once the download finishes extract the folder in /usr/lib/jvm so you obtain /usr/lib/jvm/jdk1.7.0_45/jre/bin/java. The Java binaries folder is linked so developers can quickly switch between several versions. What we are doing here, will not affect the operating system use of java, if you want to use the new version of java in your operating system, then you’ll find some instructions at the end of this post.

Firefox, Chrome:

Usually you are tempted to use the folder in ~/.mozilla, I tried, it doesn’t seem to affect any way nor Firefox, nor Chrome. The clue is to use /usr/lib/mozilla/plugins/ so Google Chrome will be able to use this plugin as well. What we need to do, if you already have an old version of java, is to remove the link called libnpjp2.so. to do so move to the directory:

cd /usr/lib/mozilla/plugins/

As you can see a link to java is already there, but it is outdated:

 lrwxrwxrwx 1 root root 50 okt 22 22:03 libnpjp2.so -> /usr/lib/jvm/jdk1.7.0_40/jre/lib/amd64/libnpjp2.so*

Remove the link with the command:

 sudo rm -f libnpjp2.so

Then we can create a new link pointing to the new downloaded java in /usr/lib/jvm/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so with the command:

ln -s /usr/lib/jvm/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so

Restart Mozilla Firefox or Google Chrome and that’s all!
enjoy your up to date java plugin for Mozilla Firefox or Google Chrome.



P.s. Fixing java for your operating system

As i wrote before, the version of java picked up by the operating system in order to execute java code depends on the symbolic link in /etc/alternatives

Just check which version of java is picked up before changing it typing:

java -version

you should get something like:

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Now, just remove the link in /etc/alternatives and replace it with a new one pointing to the new downloaded java in /usr/lib/jvm, like this:

cd /etc/alternatives
sudo rm -f java
ln -s /usr/lib/jvm/jdk1.7.0_45/jre/bin/java java

Then try to check again which version of java is in use now:

java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)


Yeeee, the new version is picked up now.

If you have problem just drop me a comment.


(Visited 4,427 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.