How to enable Java in Chrome and Firefox on Ubuntu

To enable Oracle’s Java plugin in your Linux browsers, just copy these lines into a script, and run it!

JAVA_HOME=/usr/lib/jvm/jdk1.7.0
MOZILLA_HOME=~/.mozilla
mkdir $MOZILLA_HOME/plugins
ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $MOZILLA_HOME/plugins

Note: You may need to change the value of JAVA_HOME so that it correctly points to your installation of the JDK. 64-bit users will need to change the final line to:
ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins

If you’re a newbie, here’s how to run the script:

  1. Using your favorite editor, paste the contents of the script into a new file.
  2. Find out where Oracle Java is installed. This location has the directories “bin”, “lib”, and “jre”, among others. Replace the value of JAVA_HOME with the path to this folder, and save the file. This step applies if you’re using the JDK. If you’re only using the JRE, let JAVA_HOME point to the jre installation directory (which contains the folders “bin”, “lib” and “plugin”), and modify the last line in the script to remove “jre” from the path.
  3. Make the script executable, by typing in chmod +x <filename>
  4. Run the script using the command ./<filename>
  5. Restart your browser, and confirm your installation as shown in the next section

The above script will enable Java support in both Chrome/Chromium and Firefox, since they both use the ~/.mozilla/plugins directory to scan for available plugins.

Confirming Installation

After you’ve restarted your browser, if you see a message below detailing your installed Java version and operating system, you’ll know it’s working successfully.

You can also look up the address “about:plugins” in Chrome or Firefox to get the list of plugins installed in your browser.

Alternatively, look up Oracle’s How do I test whether Java is working on my computer? to confirm the version of Java your browser is using.

Troubleshooting

If you’re facing problems with your Java plugin not working correctly on certain sites, you might want to try updating Java to the latest version. Also, you could try switching to Oracle’s version (in case you’re running the OpenJRE or IBM’s JRE), since that’s what’s best supported on the web.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>