4

I tried running the command in Ubuntu 16.04:

sudo apt-get install oracle-java7-installer oracle-java7-set-default

but it's showing an error:

enter image description here

How can I install this package?

4

Oracle JDK 6 and 7 are not available by default in Ubuntu 16.04 repositories and requires you to add repositories for the same as follows:

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

$ sudo apt-get update

You may now run your command and enjoy using Java.

If you get error while installing ppa:repository, you will need to re-install ca certificates as follows:

$ sudo apt-get install --reinstall ca-certificates

Once this is done try running first two commands again.

3
  • 1
    After running this command : "$ sudo add-apt-repository ppa:webupd8team/java", I am getting some errors : ERROR: '~webupd8team' user or team does not exist. Error: 'ppa:webupd8team/java' invalid
    – hodophile
    May 12 '16 at 13:00
  • Probably your ca certificates are not able to verify the authenticity of your ppa through SSL connection. Possible solution is to re-install ca certificates. I am updating my answer for the same. May 12 '16 at 13:57
  • I tried reinstalling ca certificate but after that the same error is coming.
    – hodophile
    May 12 '16 at 18:23
4

As of March 22, 2019, it appears that oracle-java7-installer is no longer available from the ppa:webupd8team/java upstream repo (it could be that it got move to a different archive repo).

Alternatively, you can install oracle-java8-installer instead if you have the apt repo setup properly.

1

Try this:

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

Make sure you have added the PPA first, then update your package list and then install your package.

0

Install Oracle Java 13:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt-get install oracle-java13-installer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.