Install Oracle Java 8 on Ubuntu Linux

java8_logo
To install Oracle JDK 8 on Ubuntu you can choose one of two methods:
A. Automatic installation:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

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

B. Manual installation:

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

Extract archive into /usr/local/jdk1.8.0_65

Setup
sudo update-alternatives --install  /usr/bin/java java /usr/local/jdk1.8.0_65/bin/java 1
sudo update-alternatives --install  /usr/bin/javac javac /usr/local/jdk1.8.0_65/bin/javac 1
sudo update-alternatives --install  /usr/bin/javaws javaws /usr/local/jdk1.8.0_65/bin/javaws 1

sudo update-alternatives --set  java /usr/local/jdk1.8.0_65/bin/java
sudo update-alternatives --set  javac /usr/local/jdk1.8.0_65/bin/javac
sudo update-alternatives --set  javaws /usr/local/jdk1.8.0_65/bin/javaws

Thanx to http://stackoverflow.com/a/31869659