sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Thats all !! Now to check the java version
java -version
The output will be like
java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Server VM (build 23.25-b01, mixed mode
There may come a new version,then you can simply update it with this command
sudo update-java-alternatives -s java-7-oracle
Setting up Environment variables
sudo apt-get install oracle-java7-set-default