Install Oracle Java JRE on Ubuntu 12.04
Dealing with different versions of Java Virtual Machine or Java Runtime Environment (JRE/JVM) has always been a bit of a pain, especially on Linux, where we have not only different versions, but also different vendors. To make matters worse, some application require the original Sun/Oracle version, while others are perfectly fine with open source version.
In the past, Sun provided an installer for deb and rpm based distributions, but since Ubuntu 12.04, there is no luck. However, installing Oracle’s JVM manually is actually straight forward and not complicated at all, if one know the steps involved. That’s what this article is all about.
Note: We are running the 64bit version of Ubuntu, if you’re running 32bit, make sure you adjust for the correct file versions and paths.
Remove existing Runtime Environments
Let’s first ensure that openjdk is removed if it was previously installed.
sudo apt-get purge openjdk*
Download and Extract Oracle Java JRE
mkdir ~/tmp cd ~/tmp wget http://download.oracle.com/otn-pub/java/jdk/7u5-b06/jre-7u5-linux-x64.tar.gz tar xzvf jre-7u5-linux-x64.tar.gz
Create and Move to Installation Folder
Next we create our installation folder and move the downloaded file over
sudo mkdir -p /usr/lib/jvm/jre1.7.0 sudo mv jre1.7.0_05/* /usr/lib/jvm/jre1.7.0/
Install the Oracle Java JRE 7 in your System
Update alternatives will take care of all symlinks to get Java 7 JRE registered in the system, so that we can just java and it will get recognized. That concludes the main installation.
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.7.0/bin/java 0
Mozilla Java Plugin
If you also want to enable the Mozilla plugin, create a folder to house plugin files and symlink the extension.
mkdir ~/.mozilla/plugins ln -s /usr/lib/jvm/jre1.7.0/lib/amd64/libnpjp2.so ~/.mozilla/plugins/