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:
- Using your favorite editor, paste the contents of the script into a new file.
- 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.
- Make the script executable, by typing in
chmod +x <filename> - Run the script using the command
./<filename> - 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.

Comments
IcedTea
Wouldn't it be better to do:
apt-get install icedtea-plugin
?
It uses the default-java that is already part of Ubuntu 11.04+ without adding oracles binary version.
Iced-tea plugin sounds cool
Looking at the description of the icedtea-plugin, this does seem to be a quick way of getting the Java plugin installed.
However, if you require a different binary version from Oracle or IBM due to compatibility issues (which is often the case), the above steps still apply.
IcedTea do not work with some
IcedTea do not work with some aplications like ADVFN.. IMO its better use Oracle Java.. Works everything.
yes that is better
Thanks. I tried everything as mentioned in this article, without succes. Followed yr advice and worked right away
Chrome usage of sun-java6-plugin
1. What I don't understand is how Chromium and Chrome use the symbolic link in the ~/.mozilla/plugins folder; could someone please point me to relevant documentation with these details?
2. Why isn't Chrome listed on the list of supported browsers?
http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/applet/browse...
Awesome help really, my
Awesome help really, my plugin was not working so I uninstalled it, later found that I could not install it from synaptic.
I followed your method and it now works like a charm.
Thankz
64bit Ubuntu, different JDK path
The script works only for 32 bit machines and users with Java JDK 1.7.0 in a specific location. Users with different Java version and/or path need to change the first line so that they set JAVA_HOME to match the path of their Java installation. 64bit users will need to change the final line to:
ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins
Users with only a JRE (and no JDK) will also need to make a change.
Thanks for the useful comment!
DB Whitaker,
Thank you for your useful additions. I've merged them into the main article.
java version "1.7.0_07"
java version "1.7.0_07"
OpenJDK Runtime Environment (IcedTea7 2.3.2) (ArchLinux build 7.u7_2.3.2-1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
i can't found the file libnpjp2.so in the path $JAVA_HOME/jre/lib/amd64/.
why?
Re: libnpjp2.so missing
Hey Junbo,
A quick Google search seems to suggest that some OpenJDK builds do not ship with libnpjp2.so. Since you're using OpenJDK,
sudo apt-get install icedtea-7-pluginshould do the trick for you, as Scott Carr has mentioned in a comment above. Let us know if it still doesn't work.Thanks
Thanks. The good thing about Java is that it's cross platform, "run anywhere". Oh wait it doesn't - you need _specific JVMs_ to run _some apps_. Bzzzt, fail.
Thank you very much sir !
Thank you very much sir ! This was very helpful !
Add new comment