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

Related posts

83 thoughts on “How to install oracle java 7 in ubuntu 13.04/12.10/12.04

  1. 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. 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. Great tut!
    Been looking for a straight forward install for ubuntu, and this was exacly that, and the most simple.

    Thanks alot mate!

  4. 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

  5. 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?

  6. Hi,

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

  7. 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.

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

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

    Thanks a lot for sharing.

  10. 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)
    [email protected]:~$

  11. “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.

  12. 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 comment

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