Wednesday, July 9, 2014

Installing and enabling Java plugin for Firefox running on Linux



When you use Firefox browser to access websites which need Java plug-in to display its content, It always display grey background with a link to install plug-in if the plug-in is not install or it has not configured properly. This blog explain how to install and configure Java plug-in for Firefox running in Linux operating system.

Case study : Viewing live video from D-Link camera

I have a D-Link surveillance camera and I need to see live video from vendor provided web console. When I use Firefox browser, it require eithers ActiveX or Java to display. My OS is Ubuntu Linux, So I need Java plug-in to display live video.


Download JDK or JRE from Oracle website.



Depend on your OS and CPU architecture, download JDK or JRE of your platform. For Linux OS, Oracle provide two type of file RPM and zipped TAR file. I prefer tar file because I can extract into my home directory. Downloaded file is generally placed in Downloads directory under home directory.

Extract tar file.

I make programs directory under my home directory then I will extract tar into those directory.

$ cd
$ mkdir programs
$ cd ~/Downloads
$ tar zxvf jdk-8u5-linux-x64.tar.gz -C ~/programs

**Remember that your downloaded file name is depend on your selected Java version and your platform.

Update linux file index.

After install new program or place some files in Linux system, you should update file index so that you can find the file you want faster with locate command.

$ sudo updatedb

Searching for libnpjp2.so

The plug-in file which Firefox use to display Java plug-in is named libnpjp2.so. It come with JDK/JRE we have downloaded and extracted, let's find its location.

$ locate libnpjp2.so
/home/{your_account}/programs/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so


Create symbolic link to Java plug-in.

Next step is creating symbolic link in Firefox plug-in directory to Java plug-in file.

$ cd /usr/lib/firefox/browser/plugins
$ sudo ln -s /home/{your_account}/programs/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so .

***Note : File location for creating link is getting from previous step.

Restart Firefox and see what is changed.






The grey background disappear and Java animation logo takes place but Security alert is popped up. The reason is Java plug-in doesn't display content from untrusted sites by default, You have to add trusted URL list in Java control panel.


Configure Java security to allow plug-in running in browser. 

Go to bin directory of JRE and run JControl program.

$ cd /home/{your_account}/programs/jdk1.8.0_05/jre/bin
$ ./jcontrol


 Select the Security tab then click Edit Site List to add your trusted URLs and refresh page or restart Firefox again. Java plug-in should now working when visit trusted sites.