Ubuntu has dropped including Sun/Oracle Java in its repository, and added OpenJDK. But, the former is more reliable than latter, and is also must for some applications.
Here is a way to add Sun java 6:
sudo add-apt-repository ppa:webupd8team/javaPossible error : "couldn't connect to host"
sudo apt-get update
sudo apt-get install oracle-java6-installer
To make this version as default: here.
If you want to install java 7, instead of last command try
sudo apt-get install oracle-java7-installerIf you are under proxy network or seen a error like
Cannot add PPA: 'ppa:webupd8team/java'.and if you are sure that the PPA is working, the try
Please check that the PPA name or format is correct.
sudo -E add-apt-repository ppa:webupd8team/javaand proceed with remaining commands.