How to install oracle java 7 in ubuntu 13.04/12.10/12.04

Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is the underlying technology that powers state-of-the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices.

Preparing your system

First you need to remove openjdk for this run the following command from your terminal

sudo apt-get purge openjdk*

If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA menctioned here

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update

Install oracle java 7 in ubuntu 13.04/12.10/12.04

Open the terminal and run the following commands

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

You can check the java version by searching java in dashboard

Sponsored Link

You may also like...

83 Responses

  1. Deepak says:

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    “For Uninstallation”
    sudo apt-get remove oracle-java7-installer

    How exactly it works?

  2. ppetraki says:

    Purging openjdk is a bad idea, it’ll remove anything that depends on it too. Better to install the oracle jdk and then use ‘alternatives’ to select it as the new default.

  3. Peter says:

    Very useful. Thank you

  4. mashy says:

    ohh thank you,its long time i were trying to install but gives me alot of an error,but this its useful

  5. David Maxey says:

    Thanks for the nfo!

  6. Jo says:

    Worked first time!


    I wish Canonical could employ you!

  7. Chris says:

    Worked first time for me!! Many thanks…

  8. ubuntu3 says:

    wrong: sudo apt-get purge openjdk*
    correct: sudo apt-get purge ‘openjdk*’
    a glob expansion could occur.

    wrong: sudo apt-get purge openjdk*
    correct: sudo apt-get purge ‘^openjdk.*’
    a purge(search, remove) option take a regular expression not a glob expression.

  9. Habib Rahman says:

    Thank you, I am using ubuntu 12ubuntu 12.-0.-0 your steps worked for like charm.

  10. Joe Freeman says:

    The minimal ubuntu server install does not include add-apt-repository. You can install it with the following prior to running the other commands.

    sudo apt-get install software-properties-common

  11. Lance says:

    Just wanted to say thanks. I’ve referred to this article more times than I can remember. Muchas gracias!

  12. Tim says:

    Awesome! Iยดve searched a long time for that solution. Now it works. I am happy. God bless you my friend! ๐Ÿ˜€

  13. Theo says:

    Works like charm….Thanks!

  14. Corey says:


  15. Esa says:

    Had problem with my Java 7 in Ubuntu 12.10. Followed these instruction to the letter, worked perfectly. Thank you!

  16. Kumar says:

    @cga :- U rock bro!! it works just fine

  17. Zilther says:

    You are a god among men.

  18. Paul Godden says:

    Just tried to install a Tekkit (Minecraft) server on my Linux box – thought it might be the Java 6 install of OpenJDK I had installed. Using your guide allowed me to get rid of that and get Oracle’s 7 installed in no time at all – and the Tekkit server is working nicely. Great job!

  19. merab says:

    Just great! the only answer, i’ve finally found to this problem…opensource java does not work…thanks

  20. Jacob Harding says:

    This worked but I would recommend using the Ubuntu Software Center rather than purging file and applications.

  21. Shanmukh says:

    Thanks a lot for the post. It worked for me!.

  22. Michael says:

    Thank you very much, I love you bro!!!!! lmao

  23. karthikeyan says:

    Thank you so much !!! may the force be with you !

  24. Felipe Duarte says:

    Great, this tutorial is very good because was helped me a lot.

  25. G says:

    thanks for the help ๐Ÿ™‚ works on BT like this also

  26. Alexander says:

    USC uses just the same commands.

  27. Alison says:

    Fantastic, thanks! Works on Ubuntu 11 also.

  28. Flavian says:

    Thank you man. Works on Ubuntu 13.04!

  29. Jim says:

    Fun watching the terminal get the job done.. when java8 comes out do you just change the linecommand from 7 to 8?

  30. Moony says:

    Man, I love you ๐Ÿ˜€ I’ve been trying to install java with the instructions on ubuntu wiki, with official instructions on, but nothing helped… This did!
    I don’t know who you are, I don’t know where you are, but I will find you and I will thank you ๐Ÿ™‚

    (btw Ubuntu 13.04 here, works like a charm)

Leave a Reply

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