This article is about installing the Oracle Java JDK7 (Java Development Kit 7) on the Ubuntu Operating System.

Everybody knows that Sun Java was migrated to Oracle Java with Open source licence. Similarly IBM and Open source community has their own standard Java JDK. I personally prefer Oracle's Java JDK, Since majority of the cooperates uses Oracle JDK,I also recommend Ubuntu Java beginners to start with Oracle JDK. So don't confuse while downloading/Installing Oracle Java JDK.The following steps will guide you to install Oracle JDK in Ubuntu in a very easy manner.

To install Oracle JDK in Ubuntu, Advanced Package Tools (apt) provides the many providers for oracle. The webupd8team provider provides the following command to install the Oracle JDK.

To install Oracle JDK 7, execute the following commands in the terminal.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

By executing the above command in the terminal, we installed Java in Ubuntu, But we still need to  set the environment variables. To set the JAVA_HOME environment variable, execute the following commands in the terminal.

sudo update-alternatives --config java

This will return the installed java version in the system.

There are 1 choices for the alternative java (providing /usr/bin/java).
Selection   Path                                       Priority   Status
  *0        /usr/lib/jvm/java-7-oracle/jre/bin/java    1062       auto mode 
   1        /usr/lib/jvm/java-7-oracle/jre/bin/java    1062       manual mode

Press enter to keep the current choice[*], or type selection number:

Now copy the path from your preferred installation and then edit /etc/environment file by the command

sudo nano /etc/environment
This will open the environment file in nano editor, in the opened file add the following line

After adding this line, press ctrl+o and enter to save the file and ctrl+X to close the file. Finally we installed the Oracle JDK 7 in the Ubuntu Operating system.