Ubuntu – Install oracle-java7-installer showing error

16.04aptjava

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?

Best Answer

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.