I have a problem while trying to install third-party component Oracle Java 8. Every time I type:
$ sudo apt-get install oracle-java8-installer
I get this answer:
Reading package lists... Done
Building dependency tree
Reading state information... Done
oracle-java8-installer is already the newest version (8u131-1~webupd8~2).
The following package was automatically installed and is no longer required:
snap-confine
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up oracle-java8-installer (8u131-1~webupd8~2) ...
Using wget settings from /var/cache/oracle-jdk8-installer/wgetrc
Downloading Oracle Java 8...
--2017-07-05 15:57:12-- http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 2.22.144.107, 2.22.144.51
Connecting to download.oracle.com (download.oracle.com)|2.22.144.107|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-07-05 15:57:12 ERROR 403: Forbidden.
download failed
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
I think I couldn't install Oracle JDK 8. I tried so hard to do this, but I got this error.
Best Answer
This is caused by the fact that the PPA maintainer hasn't updated their scripts yet and older updates of Java 8 are no longer available from Oracle.
To quickly resolve this, you can do the following and install 8u151. (This will only work so long as 8u151 is available from Oracle)
1) Install as normal:
Once that is done and you get the error:
oracle-java8-installer E: Sub-process /usr/bin/dpkg returned an error code (1)
2) You will then have to do the following for 8u151 to be installed:
3) Once you complete the above, you can run the install again and it will succeed.