I am trying to install Java 7 in Ubuntu 13.04 using this tutorial.

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

All goes well until I reach the point:

sudo apt-get install oracle-java7-installer

Then I just get the error message

E: Unable to locate package oracle-java7-installer

What is the problem that is causing this?

  • Did you add ppa for oracle-java7-installer package successfully?
    – cuonglm
    Commented May 15, 2014 at 17:33
  • 1
    13.04 is end of life. You can add the PPA from bobberson012 but you really should upgrade.
    – Rinzwind
    Commented May 15, 2014 at 17:38

2 Answers 2


You first have to add the WebUPD8 repository to your system:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Then install the package oracle-java7-installer.

If you already added the repository to your system, it could be you just never performed a sudo apt-get update, to update the package list.

Another option is OpenJDK.

  • The tutorial am using has it. ubuntugeek.com/… Commented May 15, 2014 at 17:37
  • That is the tutorial he referred to.
    – IBPX
    Commented May 15, 2014 at 17:38
  • See sudo add-apt-repository ppa:webupd8team/java and sudo apt-get update is already in the tutorial and its not working. I still get the error. Commented May 15, 2014 at 17:45
  • You already ran sudo apt-get purge openjdk*, right?
    – IBPX
    Commented May 15, 2014 at 18:14
  • Also, can I ask why you want to use Oracle Java 7 instead of OpenJDK?
    – IBPX
    Commented May 15, 2014 at 18:19

If you don't want to resort to OpenJDK, you can just use a different Ubuntu version in your /etc/apt/sources.list.d/webupd8team-java.list file:

deb http://ppa.launchpad.net/webupd8team/java/ubuntu quantal main
# deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu quantal main

Instead of "quantal" you can probably use any of the values from the drop-down list named "Published in:" on the WebUPD8 team page. I'm on "raring" which is not available directly, but this works perfectly.

Rationale: the installers provided by WebUPD8team simply download and run the official Java installer from Oracle, which is the same for all versions of Ubuntu (currently anyway). Therefore it does not matter which "installer installer" you really use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .