I ran the following commands to install java: sudo add-apt-repository ppa:webupd8team/java and sudo apt-get update. After that I ran sudo apt-get install oracle-java8-installer and got an error. Here's the error:

Connecting to download.oracle.com (download.oracle.com)||:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-17 17:13:56 ERROR 404: Not Found.

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:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Did I miss a step here? I searched for this error and the only thing I found was a question here in AskUbuntu instructing OP to run sudo apt-get purge oracle-java9-installer (I changed java9 to java8 since I'm trying to install java 8) then ran the command sudo apt-get install oracle-java8-installer again. It did not work.

  • Same problem with JDK 10. PPAs don't update links immediately when a new version is released. – Sina Madani Apr 18 '18 at 10:12

A new Java version was released: http://www.oracle.com/technetwork/java/javase/downloads/index.html I guess you'll have to wait for the PPA to add the new version and then try again.

  • Is there another way to install java 8? – jaryl Apr 17 '18 at 23:12
  • I see the PPA was updated so you can repeat the steps and it should work now. – Logix Apr 18 '18 at 19:06

Uninstalling openJDK solved my problem. I uninstalled it and then ran sudo apt-get install oracle-java8-installer again. Now Java 8 is installed.

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