Setup Latest Oracle JDK on Ubuntu Linux

Most of people understand that installing Oracle JDK & JRE on their Windows machine is mostly easy like eating peanuts ( Well, they might still need to setup JAVA_HOME variable & update their PATH variable though). It can be turned out to be a problem when due to some case they need to move from Windows to Linux development environment, such as Ubuntu Linux. In this HOW TO article, i’ll cover the steps for setting up the JDK on Ubuntu Linux. I hope it would be useful for anyone whom are still having problem with it.

  • Open a terminal window (press CTL+T) and run these commands in order (we’ll assume that we are going to install JDK version 7 ):
    1. sudo add-apt-repository ppa:webupd8team/java
    2. sudo apt-get update
    3. sudo apt-get install oracle-java7-installer
    
  • If you wish to remove the JDK from your machine, run this command in the terminal box:
    sudo apt-get remove oracle-java7-installer
  • Should you need to upgrade your current JDK version to the latest one, you could try running this command and see if it would work:
    sudo update-java-alternatives -s java-7-oracle
  • If the prior command does not work then you could remove your current JDK and re-install the latest one using prior steps as the last resort.

Those are the steps that I always follow when setting up JDK on my Ubuntu machine. Until the time I written this post, i still found no problem when using it on my Intellij IDEA 12.1,  working for either Android application development or Play 2 based web application development.