Cannot install Oracle JDK via apt in Ubuntu 16.04
Solution 1
First of all in case you think you need Oracle Java because of some stupid tutorial you found on the internet, all you need to do to install Java in all currently supported versions of Ubuntu is to run this command:
sudo apt install default-jdk
If you're continuing on to read the rest of this answer, then you think that you need to install Oracle Java instead of the installing a Java package from the default Ubuntu repositories.
I tried to download Oracle Java 9 manually from the official Oracle website at: http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html and the link to download jdk-9.0.4_linux-x64_bin.tar.gz is working. If download link is not working because it's been updated, go to the official Oracle website and download Java from there. Your other alternative is to install openjdk-9-jdk from the default Ubuntu 16.04 repositories.
Install Oracle Java JDK the manual way
Java 8 can also be installed the same way. The link to download Java 8 manually from the official Oracle website is: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Solution 2
For people just arriving at this question, Oracle Java 9, because it is not an LTS version, is now end-of-life and cannot be downloaded. Unfortunately, Java 10 isn't yet available through the Web Upd8 PPA, but their PPA page recommends another PPA for that.
Oracle Java 8
Java 8 is an LTS version that will last a lot longer than Java 10 and can be installed with:
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Oracle Java 10
Java 10 is a non-LTS version that won't last long and can be installed with:
sudo apt-add-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer
Related videos on Youtube
PicoDeGallo
Updated on September 18, 2022Comments
-
PicoDeGallo over 1 year
I created a new Ubuntu 16.04.3 VM and am attempting to install JDK 9. Unfortunately, the latest version of the JDK
apt
installer,9.0.1-1~webupd8~0
, is failing to download the binaries and I suspect that the reason is because JDK 9.0.4 was released today and Oracle moved the archives around.I carried out the typical steps for installation:
add-apt-repository ppa:webupd8team/java apt-get update && apt-get install oracle-java9-installer
I am then prompted with the following error message:
Downloading Oracle Java 9... --2018-01-16 15:15:07-- http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz Resolving download.oracle.com (download.oracle.com)... 23.200.70.136 Connecting to download.oracle.com (download.oracle.com)|23.200.70.136|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz [following] --2018-01-16 15:15:11-- https://edelivery.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.35.226.115, 2600:1404:21:49d::2d3e, 2600:1404:21:493::2d3e Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.35.226.115|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz?AuthParam=1516137431_0e89d10b30203a572ea858768475ef74 [following] --2018-01-16 15:15:11-- http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.tar.gz?AuthParam=1516137431_0e89d10b30203a572ea858768475ef74 Connecting to download.oracle.com (download.oracle.com)|23.200.70.136|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2018-01-16 15:15:11 ERROR 404: Not Found. download failed Oracle JDK 9 is NOT installed. dpkg: error processing package oracle-java9-installer (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: oracle-java9-installer E: Sub-process /usr/bin/dpkg returned an error code (1)
I found this thread that addressed it for the JDK 9 GA, but it does not appear that the latest reply works for JDK 9.0.4+11. I've updated the SHA checksums (found on this page), set the major version to 9.0.4, and set the minor version to 11, but I'm still not having success.
What steps need to be carried out to get the JDK
apt
installer to work until the WebUpd8 team is able to update the PPA? -
PicoDeGallo over 6 yearsI was able to perform a manual install of JDK 9.0.4 with the instructions on the post you linked. I actually prefer this method and learned a good chunk more by reading further on it. Since Oracle doesn't have an official PPA and WebUpd8's unfortunately breaks on new releases, this seems like a better all around solution especially with a bash script. Thank you sir!
-
Rahim over 6 years@PicoDeGallo does the bash script handle updates too?
-
karel over 6 yearsThe openjdk-9-jdk package from the default Ubuntu repositories is updated automatically by the Software Updater application. Oracle Java is not updated automatically unless you installed it from the PPA.
-
Zanna almost 6 years(+1 but I really need stupid Oracle Java because the stupid applet I have to use for my job refuses very stubbornly to work otherwise (I tried really hard, but there's only so much I can do as the end user))
-
karel almost 6 years@Zanna Oracle Java is bundled with JavaFX. In Ubuntu JavaFX is packaged as a separate app, named openjfx (Rich client application platform for Java). Maybe it would would work for your applet at work, maybe not.