Installing Oracle Java in Ubuntu 12+

This describes the steps to install the Oracle Java (JDK) 8, Oracle Java (JDK + JRE) 7 or Oracle Java (JDK) 6 on Ubuntu 13.04, Ubuntu 12.10 and Ubuntu 12.04.

The Oracla Java has been removed from the official Ubuntu repositories due to some Java licence issues.

Before installation, OpenJDK needs to be removed, if previously installed:

sudo apt-get purge openjdk*

In order not to get issues with the add-apt-repository command, install the following package:

sudo apt-get install software-properties-common

Add the PPA:

sudo add-apt-repository ppa:webupd8team/java

Update the repo index:

sudo apt-get update

Install Java 8:

sudo apt-get install oracle-java8-installer

Or, install Java 7:

sudo apt-get install oracle-java7-installer

Or, install Java 6:

sudo apt-get install oracle-java6-installer