How to Install Oracle Java JDK 6/7/8 on Ubuntu 13.04 / 12.10 / 12.04

Hello Linux Geeksters.

In this article I will show you how to install the Oracle Java (JDK) 8, Oracle Java (JDK + JRE) 7 or Oracle Java (JDK) 6 on Ubuntu 13.04, Ubuntu 12.10 and Ubuntu 12.04.

The Oracla Java has been removed from the official Ubuntu repositories due to some Java licence issues.

Before you install it, remove OpenJDK, if you have it installed:

$ sudo apt-get purge openjdk*

To install Java 8/7/6, do this:

In order not to get issues with the add-apt-repository command, install the following package:

$ sudo apt-get install software-properties-common

Add the PPA:

$ sudo add-apt-repository ppa:webupd8team/java

Update the repo index:

$ sudo apt-get update

Install Java 8:

$ sudo apt-get install oracle-java8-installer

Or, install Java 7:

$ sudo apt-get install oracle-java7-installer

Or, install Java 6:

$ sudo apt-get install oracle-java6-installer

Share and Enjoy

  • Twitter
  • Facebook
  • Google Plus
  • Email
  • RSS
Tagged with: , , , , , , , , ,
Posted in The Linux and Unix Articles!
21 comments on “How to Install Oracle Java JDK 6/7/8 on Ubuntu 13.04 / 12.10 / 12.04
  1. Carlo Savignano says:

    Hi, first thanks for the guide. second, i would like to notice you of a typo error. The java 6 command should be “oracle-java6-installer” indeed of “oracle-java67-installer”. Thanks for the attention.

    Carlo Savignano

  2. RTJ says:

    good post.
    Thanks for the info.

  3. Kevin says:

    How are future java updates handled when using this method to install java?

  4. Andrew says:

    Thanks for the guide. You should also run:

    sudo apt-get install oracle-java8-set-default

  5. Lothinator says:

    Now this junk tries to force me to install GCJ java instead when I try to remove OpenJDK… Purge actually installs the other. Purge GCJ and it reinstalls OpenJDK… Purge OpenJDK and it reinstalls GCJ…

    They are being jerks about this at Ubuntu!!! I don’t care about philosophical issues, I need to use Sun JDK because that’s what works with the tools i’m using. And they’re FORCING me to use something else…

    • Mark says:

      Maybe they’re not being jerks but there’s a dependency issue in Ubuntu that requires at least one JDK?

      To be honest, there is no harm in leaving OpenJDK. I installed Oracle JDK alongside with no problems. No need to purge it.

  6. vimukthi says:

    thnkz for help

  7. Sanchixx says:

    I love you!!!!!

  8. Erin Hodgess says:

    Great guide! Thanks so much

  9. debuger says:

    Very good post. Thanks a loot. I’m terrible angry with install JDK on 13.04 before find this article.

  10. Hendo says:

    If you get a ‘add-apt-repository command not found’ when trying to add the ppa, then run:

    $:~# sudo apt-get install software-properties-common

    and all should be good and nice in the world once again.

  11. Simo says:

    Very good post. Thanks so much

  12. Roberto Marin says:

    Excelent work!

  13. mascot says:

    Very helpfull, big thx !!

  14. aeternam says:

    Thnx for tutorial!

  15. prashasth baliga b says:

    really good one :) thanks a lot :) good job :)

  16. dora says:

    thanks, this was really helpfull, very good tutorial, worked for me on ubuntu 13.10 .

  17. suresh says:

    thanks for this tutorial

  18. Eduardo says:


  19. Aj says:

    Installed successfully. Thank for you for the post!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!