Installing Oracle Java 7 on Ubuntu Precise Pangolin

This is specially useful in vagrant machines

  1. Install utility to add apt sources easily:

    sudo apt-get install python-software-properties
  2. Add sources that contains oracle-java-7

    sudo add-apt-repository ppa:webupd8team/java
  3. Update the apt source list and install java’s oracle version

    sudo apt-get update; sudo apt-get install oracle-jdk7-installer

Done.