sudo apt-get install python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update
Then, depending on the version you want to install, execute one of the following commands:
Oracle JDK 6This is an old version but still in use.
sudo apt-get install oracle-java6-installer
Oracle JDK 7This is the latest stable version.
sudo apt-get install oracle-java7-installer
Oracle JDK 8This is a developer preview, the general release is scheduled for March 2014. This external article about Java 8 may help you to understand what it's all about.
sudo apt-get install oracle-java8-installer