Java is designed to be cross platform and vendor independent, so you should be able to use the JDK (Java Development Kit) from any vendor on any supported platform. generally this is the case but if you want to develop with IDE, (Integrated Development Environment) you may prefer to use a specific JDK that you feels works best with the IDE. Ubuntu has within their stand web repositories the openJDK version of Java, if you would like to install Oracle Java then you will need to add in a web repository that hosts the package you require.
The WEB UPD8 team hosts a PPA (Personal Package Archive) for Oracle Java as well as other additional products. To add the repository in use the command:
sudo add-apt-repository ppa:webupd8team/java
This command will also write to and create the file:
/etc/apt/sources.list.d/webupd8team-java-quantel.list
This file then makes the repository that you have added persistent, the contents point to the physical repository that is discovered for the version of Ubuntu that you use. The file on my 12.10 machine using the 12.10 release Quantel Quetzal , looks like this:
deb http://ppa.launchpad.net/webupd8team/java/ubuntu quantel main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu quantel main
With the repository added we should update the local cache so we can locate the software to install and then run the installer for Java:
sudo apt-get update
sudo apt-get install oracle-java7-installer
And there we have it you are ready to go. Step through the video for a full demo