Monday, March 17, 2014

Installing Sun JRE (Java Run-time Environment ) in Ubuntu

Hi Everyone,

Some-times ago, I gave you the installation steps for Sun Java  ( Now Oracle Java ) for the Ubuntu Linux @ my previous post about installing sun jre  . But now that doesn't seems to work even for me as Oracle has removed the binary ( .bin ) file from their website . Even the steps given at https://www.java.com/en/download/help/linux_install.xml  or the PPA method of webupd8 as mentioned in Ubuntu Community Wiki doesn't seems to help.

So, I decided to do something different, which I have formulated in steps as below :-

1) Download the rpm file labelled as "Linux RPM" from the java website

2) Install alien package from Ubuntu repositories.
         sudo apt-get install alien
3) Go to the directory where you have downloaded the rpm file. For example, if your file was downloaded to Downloads directory then :-
         cd ~/Downloads
4) Use alien to Convert the rpm package to deb package. This may take a while.
         sudo alien --to-deb --scripts jre-7u51-linux-i586.rpm
5) Use dpkg to install the newly generated deb package.
         sudo dpkg -i jre_1.7.051-1_i386.deb
    You can also use The Ubuntu-Software-Center or GDebi-Package-Installer for the above purpose.
6) Use following command to verify the installation :- 
          java -version

Output will be something similar to this as show in the above screenshot:-

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)

7) To install the firefox plugin, do the following :-
    a) Go to Firefox-plugin install directory
            cd /usr/lib/firefox-addons/plugins/
    b) create a soft-link ( shortcut ) for the Java plugin in the directory :-
            sudo ln -s /usr/java/jre1.7.0_51/lib/i386/libnpjp2.so .
    c) To verify, you can launch Firefox and type about:plugins and its ready for use.
8) To install the java plugin for Google chrome, do the following:-
   a) Go to Google chrome installation directory
         cd /opt/google/chrome
   b) create a directory named plugins here ( if its not there ) . At least, it was absent from mine chrome installation ;) 
        sudo mkdir plugins
   c) Now create a soft-link ( shortcut ) for the Java plugin in the directory :-
         sudo ln -s /usr/java/jre1.7.0_51/lib/i386/libnpjp2.so .
   d) Now, you can launch Google chrome and type chrome://plugins/ to verify the installation and start using the plugin.

Note:- The above steps have been tested on The Lubuntu 14.04 beta 1.