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. The_Doodle says:

    nice nice nice!! Many thanks! Last time I tried installing oracle java it was a real pain in the *ss. Worked like a charm, very clean!!! <3

  2. LukCAD says:

    Thank you guys! The oracle java has been installed successfully even i had troubles with my own applications. But in result i have got the real $JAVA_HOME which points to real JAVA. Ubuntu is great now with such improvement. Serious app can be installed now in moment.

  3. Flatus says:

    How to install Java 64-bit?

  4. Mohammed says:

    Thank you very much. This is only guide that works.

  5. Rune Pedersen says:

    Great tut!
    Been looking for a straight forward install for ubuntu, and this was exacly that, and the most simple.

    Thanks alot mate!

  6. David T says:

    This process apparently installs the 32-bit version of Java. Any instructions on how to install the 64-bit version? (because the 32-bit version won’t run on 64-bit Ubuntu 13.04). Thanks

  7. S says:

    Works fine up until the point:
    “sudo apt-get install oracle-java7-installer”

    Just get the error message
    E: Unable to locate package oracle-java7-installer

    Did I mess something up?

  8. C says:

    Same here. What is the problem that is causing this?

  9. Aubrey Bourke says:


    Just download the netbeans and jdk bundle from Oracle. It will install everything for you..

  10. D says:

    Seems to work in 13.10 Saucy Salamander as well, just installed it on the final beta.

  11. Eddie says:

    The only problem with this approach since 2013 is that Java release a massive 100Mb+ update every few weeks via an incredibly slow repo at

    It can take up to 20 minutes to down the 100Mb using a 120Mbps connection. It often times out and you have to start again.

    I don’t know why Java have changed their working practices – probably weak security, but so many big and slow updates is unprofessional.

  12. sa says:

    Good stuff. installed java7 in a flash

  13. Tina Bornaman says:

    It 100% works thanks

  14. chuckie says:

    thanks, this is so simple compared to some of the other instructions out there. worked on 4 machines. thanks again!

  15. meenakshi says:

    Thanks it worked.

  16. Mohd Farid says:

    Very useful. Worked as expected without any hiccups at all.

    Thanks a lot for sharing.

  17. _darth_vaider_ says:

    hangs at okay…. …. …. ….ect for a long time is this normal?

  18. Smriti says:

    getting this error…new to ubuntu please guide

    Proxy request sent, awaiting response… 403 Forbidden file type or location
    2014-03-07 18:48:46 ERROR 403: Forbidden file type or location.

    download failed
    Oracle JDK 7 is NOT installed.
    dpkg: error processing oracle-java7-installer (–configure):
    subprocess installed post-installation script returned error exit status 1
    Setting up gsfonts-x11 (0.22) …
    Errors were encountered while processing:
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  19. Cosmoflop says:

    Have you installed Java 7 from the Ubuntu Software Center?

  20. Coca says:

    Thanks you for this helpful instruction

  21. elite facebook says:

    works greate thanks.

  22. Sam says:

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

    What am I doing in the fist two steps above. The last one is obvious.

  23. Jan Kazemier says:

    In the first command you are adding a repository to apt, where you can find the installer. The second command updates the cache of apt, after which it can find the oracle-java7-installer.

Leave a Reply

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