Installing oracle JDK in Ubuntu, Linux Mint or Debian via PPA

The easiest way to install Oracle JDK in ubuntu is through terminal.

Just run some commands and you are good to go.

Lets start.

  1. Add a ppa repository
sudo add-apt-repository ppa:webupd8team/java
  1. Sync local repo with newly added ppa repo.
sudo apt-get update
  1. Install JDK of your choice ranging from JDK 6 to 9
sudo apt-get install oracle-java6-installer
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java9-installer

but remember after installing JDK based on version it may be set as default JDK, still you can set/change default JDK by running below commands.

For those having problem with installing JDK 6/7 i.e 404-Not Found or Unable to download, you can download JDK 6/ JDK 7 from Oracle website and keep the downloaded file in the following location based on JDK you are trying to install


and trying the above commands again, you will be able to install them again.

sudo apt-get install oracle-java6-set-default
sudo apt-get install oracle-java7-set-default
sudo apt-get install oracle-java8-set-default
sudo apt-get install oracle-java9-set-default

If you have already installed java other than oracle or want to use a java already installed in your system from the available java, you can run below command and choose the appropriate java of your choice.

sudo update-alternatives --config java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s