Install Oracle JDK 8 on Ubuntu 14.04

This post describe how to download and install Oracle JDK 8 on Ubuntu 14.04, and also update alternatives to correct the links.

Download Oracle JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Accept License Agreement and download the corresponding .tar.gz file, jdk-8u11-linux-i586.tar.gz in my case.

Unpack the downloaded tarball (.tar.gz) and move unpacked folder to where you want, /home/u/jdk1.8.0_11/ in my case.

Run the following commands in terminal to update the alternatives of javac and java. Where /home/u/jdk1.8.0_11/ is the installed folder of jdk.

$ sudo update-alternatives --install /usr/bin/javac javac /home/u/jdk1.8.0_11/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /home/u/jdk1.8.0_11/bin/java 1

$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java

After installed and setup

Step-by-step: