Tuesday, January 21, 2014

Java JRE Webex Firefox Ubuntu 64 bit



I will talk about how to get your Java plugin working on Firefox on Ubuntu. It is also about getting your webex working on Firefox.

First you install oracle-java7-installer using apt-get. You can search on Google for this. Anyway, I am putting it here for your convenience.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
 
You can check Java version using the following command:
 
$ java -version 
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) 
 

You can also check if the Java version is working or not from this site. This is the latest Java version available at this point of time for java which I installed recently. From time to time, the new versions come up and your Java applications stop working for one reason to another. In the paragraph below, I will now discuss about installing a new version Java plugin for Firefox

Download the latest version of JRE from this site. Download the Linux64 version of the package. The downloaded package has a name like "jre-7u51-linux-x64.tar.gz". Now create a folder /usr/java/ and copy this file into it. Extract the tarball inside this folder. You will have something like this:

$ cd /usr/java/
$ sudo tar -xzvf  jre-7u51-linux-x64.tar.gz
$ ls 
jre1.7.0_51

You can remove the tar-ball if you want. Now we need to create a link to a specific library "libnpjp2.so" present in this folder to a place where Firefox can find it.

$ cd /usr/lib/mozilla/plugins
$ ln -s /usr/java/jre1.7.0_51/lib/amd64/libnpjp2.so libnpjp2.so

You can rename the already existing link so that you can restore it in case the new version creates problem for you.  Now you can restart your firefox and test if your java application is working.


This new version of Java (version 1.7.0_51) leads to security permission error for many sites. So, you need to add exceptions to these sites. It can be done by accessing the Java Control Panel. Press ALT+F2 and type "ControlPanel" to access Oracle java 7 Plugin Control Panel. Go to the Security tab and Click on " Edit Site List" under "Exception Site List" section. Here you add the site which is giving error regarding security permissions.  Add the sites and click OK and close the panel.

Now try opening the website having the application (for instance Webex). It should work without any problem this time. 


For running java plugin on Firefox, you do not need to install Oracle-Java-installer or JDK installer. You only need the java run-time (jre) package that you can download from the official Java homepage.  You can run the ControlPanel directly from command line: 

$ /usr/java/jre1.7.0_51/bin/ControlPanel



Sometimes it is necessary to set the default java version to the downloaded JRE package in case you have multiple Java versions installed on your system. For instance,   I get following output for java version: 

$ java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu1)

OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)


Then I download jre-8u25-linux-x64.tar.gz package from Oracle website and extract it inside a folder "/usr/java/".


$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/java/jre1.8.0_25/bin/java" 1

$ sudo update-alternatives --set java /usr/java/jre1.8.0_25/bin/java

$ sudo update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      auto mode
* 1            /usr/java/jre1.8.0_25/bin/java                   1         manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode

Press enter to keep the current choice[*], or type selection number: 

Now check the default java version using the following:

$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

As you can, the default java version is set to the JRE package installed separately as explained above.