HostOnNet Blog

Installing Sun Java on Ubuntu

Download JDK from

http://www.oracle.com/technetwork/java/javase/downloads/index.html

For 32 bit systems

jdk-8u5-linux-i586.tar.gz

For 64 bit systems

jdk-8u5-linux-x64.tar.gz

Extract it and move it to /var/lib/jvm

tra zxvf  jdk-8u5-linux-x64.tar.gz
jdk1.8.0_05
sudo mkdir -p /usr/lib/jvm
sudo mv ./jdk1.8.0_05 /usr/lib/jvm/

Set it as default Java

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_05/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_05/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_05/bin/javaws" 1

Run following commands to make sure new java installation is the default

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

To activate Browser plugin, run

sudo ln -s /usr/lib/jvm/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so /usr/lib/firefox/browser/plugins
sudo mkdir /opt/google/chrome/plugins
sudo ln -s /usr/lib/jvm/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so /opt/google/chrome/plugins

For 32 bit systems

sudo ln -s /usr/lib/jvm/jdk1.8.0_05/jre/lib/i386/libnpjp2.so /usr/lib/firefox/browser/plugins
sudo mkdir /opt/google/chrome/plugins
sudo ln -s /usr/lib/jvm/jdk1.8.0_05/jre/lib/i386/libnpjp2.so /opt/google/chrome/plugins

Now restart browser, you have Java Plugin installed properly.


Posted in Ubuntu