17

I uninstalled jdk packages and now can't install them back. I managed to install oracle-java7-installer and oracle-java8-installer but can't install oracle-java9-installer. It seems that my computer tries to download wrong version of oracle-java9-installer 177 when version i would be able to download is 178.

$ wget http://download.java.net/java/jdk9/archive/178/binaries/jdk-9+178_linux-x64_bin.tar.gz
--2017-07-21 11:00:02--  http://download.java.net/java/jdk9/archive/178/binaries/jdk-9+178_linux-x64_bin.tar.gz
Connecting to 10.144.1.10:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 293348142 (280M) [application/x-gzip]
Saving to: 'jdk-9+178_linux-x64_bin.tar.gz'

jdk-9+178_linux-x64_bin.tar.gz     1%[>                                                          ]   5.42M  5.04MB/s               ^C

$ wget http://download.java.net/java/jdk9/archive/177/binaries/jdk-9+177_linux-x64_bin.tar.gz
--2017-07-21 11:00:16--  http://download.java.net/java/jdk9/archive/177/binaries/jdk-9+177_linux-x64_bin.tar.gz
Connecting to 10.144.1.10:8080... connected.
Proxy request sent, awaiting response... 404 Not Found
2017-07-21 11:00:17 ERROR 404: Not Found.

Can you help? apt-get tries to install Oracle JDK 9.

I run Ubuntu 16.04 in virtual machine hosted by win7

Full error message:

sudo apt-get install oracle-java9-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
oracle-java9-installer is already the newest version (9b177-1~webupd8~0).
0 upgraded, 0 newly installed, 0 to remove and 147 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] Y
Setting up oracle-java9-installer (9b177-1~webupd8~0) ...
Using wget settings from /var/cache/oracle-jdk9-installer/wgetrc
Downloading Oracle Java 9...
--2017-07-21 10:54:11--  http://download.java.net/java/jdk9/archive/177/binaries/jdk-9+177_linux-x64_bin.tar.gz
Connecting to 10.144.1.10:8080... connected.
Proxy request sent, awaiting response... 404 Not Found
2017-07-21 10:54:13 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-installerE: Sub-process /usr/bin/dpkg returned an error code (1)
  • Check your network connection on your VM. – George Udosen Jul 21 '17 at 9:17
  • 2
    Definitely not a network issue. The file doesn't exist. – Nathan J.B. Jul 23 '17 at 5:44
  • Just tried to install from the webupd8 PPA and it was successful without having to modify any of the files mentioned in previous answers. – mkobit Oct 2 '17 at 15:06
13

For the GA release version of the JDK use:

cd /var/lib/dpkg/info
sudo sed -i 's|SHA256SUM_TGZ="2ef49c97ddcd5e0de20226eea4cca7b0d7de63ddec80eff8291513f6474ca0dc"|SHA256SUM_TGZ="1c6d783a54fcc0673ed1f8c5e8650b1d8977ca3e856a03fba0090198e0f16f6d"|' oracle-java9-installer.*
sudo sed -i 's|JAVA_VERSION_MINOR=181|JAVA_VERSION_MINOR=181|' oracle-java9-installer.*
sudo sed -i 's|FILENAME=jdk-${JAVA_VERSION_MAJOR}+${JAVA_VERSION_MINOR}_linux-${dld}_bin.tar.gz|FILENAME=jdk-${JAVA_VERSION_MAJOR}_linux-${dld}_bin.tar.gz|' oracle-java9-installer.*
sudo sed -i 's|PARTNER_URL=http://download.java.net/java/jdk${JAVA_VERSION_MAJOR}/archive/${JAVA_VERSION_MINOR}/binaries/$FILENAME|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}+${JAVA_VERSION_MINOR}/$FILENAME|' oracle-java9-installer.*
  • 1
    Nice! Works awesome! – ST-DDT Sep 22 '17 at 8:06
  • 1
    Maybe you should share your solution at askubuntu.com/questions/958241/… as well. – ST-DDT Sep 22 '17 at 8:07
  • Not working as of now (result is: http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_linux-x64_bin.tar.gz?AuthParam=1520554549_5bf6956d13a5d1a36d40ce55d3ccf989 Connecting to download.oracle.com (download.oracle.com)|2.21.188.165|:80... connected. HTTP request sent, awaiting response... 404 Not Found) – Jules Mar 9 '18 at 0:14
10

Prefer a friend solution

sudo apt-get install oracle-java9-installer
cd /var/lib/dpkg/info
sudo sed -i 's/=177/=179/' oracle-java9-installer.*
sudo sed -i 's/SHA256SUM_TGZ="a6905f3a4245a071880e1793b8d3d6100ef7b171ea1d6ebfe6312c25c2fca8bb"/SHA256SUM_TGZ="06fe58dfa50c4f6ca21dc1d475f16cd9e58db36b1d98582091d7ff9005dda7a7"/' oracle-java9-installer.*
sudo apt-get install oracle-java9-installer
10

I've just experienced the same problem and done the following:

  1. cd /var/lib/dpkg/info/
  2. in all files oracle-java9-installer.* change version numbers 177->178 and SHA256SUM_TGZ to what you see on the official website
  3. sudo apt-get install oracle-java9-installer

I know that it is dirty and incorrect way, but I didn't manage to find any alternatives

  • "and SHA256SUM_TGZ to what you see on the official website" Could you provide said value, or website's url ? I feel like I'm looking for a needle in a haystack – Balmipour Jul 21 '17 at 14:57
  • I found the SHAs here: jdk.java.net/9 (accept the terms first). I'm working through Olga's solution to see if it works now... – Nathan J.B. Jul 23 '17 at 5:44
  • Confirmed that it works! Make sure you get the SHA256 from the correct Linux type (ARM vs not; 32 vs 64). You don't need to replace ALL of the SHA256 hashes -- only the one for the architecture your computer uses. – Nathan J.B. Jul 23 '17 at 5:52
  • Thanks alot! you saved me from creating new VM which would have took for like 1-2 working days! – Akseli Arvaja Jul 24 '17 at 7:06
  • askubuntu.com/a/966163/46543 answer works now (2017-10-18). – Lord Loh. Oct 19 '17 at 1:42
8

The newest version of the installer, 9.0.1-1~webupd8~0, now functions properly.

Previous answers do not work for version 9b181-1~webupd8~2 of the installer, and some previous versions.

Note, the JDK version is 9.0.1 now, not 9 (beta) as this installer expected. It was out of date, downloads had been (re)moved also, so it couldn't even get the old beta to install.

The following worked:

sudo apt-get install oracle-java9-installer

You can use ls oracle-java9* to see relevant files in this directory:

cd /var/lib/dpkg/info

Fix the incorrect sum, in oracle-java9-installer.config actually:

sudo sed -i 's|SHA256SUM_TGZ="2ef49c97ddcd5e0de20226eea4cca7b0d7de63ddec80eff8291513f6474ca0dc"|SHA256SUM_TGZ="2cdaf0ff92d0829b510edd883a4ac8322c02f2fc1beae95d048b6716076bc014"|' oracle-java9-installer.*

Fix a second incorrect sum, in oracle-java9-installer.postinst:

sudo sed -i 's|SHA256SUM_TGZ="1c6d783a54fcc0673ed1f8c5e8650b1d8977ca3e856a03fba0090198e0f16f6d"|SHA256SUM_TGZ="2cdaf0ff92d0829b510edd883a4ac8322c02f2fc1beae95d048b6716076bc014"|' oracle-java9-installer.*

Next:

sudo sed -i 's|JAVA_VERSION_MAJOR=9|JAVA_VERSION_MAJOR=9.0.1|' oracle-java9-installer.*
sudo sed -i 's|JAVA_VERSION_MINOR=181|JAVA_VERSION_MINOR=11|' oracle-java9-installer.*
sudo sed -i 's|J_DIR=jdk-9|J_DIR=jdk-9.0.1|' oracle-java9-installer.*
sudo sed -i 's|FILENAME=jdk-${JAVA_VERSION_MAJOR}+${JAVA_VERSION_MINOR}_linux-${dld}_bin.tar.gz|FILENAME=jdk-${JAVA_VERSION_MAJOR}_linux-${dld}_bin.tar.gz|' oracle-java9-installer.*
sudo sed -i 's|PARTNER_URL=http://download.java.net/java/jdk${JAVA_VERSION_MAJOR}/archive/${JAVA_VERSION_MINOR}/binaries/$FILENAME|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}+${JAVA_VERSION_MINOR}/$FILENAME|' oracle-java9-installer.*

Then install, again:

sudo apt-get install oracle-java9-installer

You can also download the java9 tgz package separately and place it in /var/cache/oracle-jdk9-installer once you have tried (and failed) installing (it will make the directory). After performing the above fixes it will install from the cached version (keep a backup copy) instead of trying to download again.

  • This is the solution that worked for me on 2017-10-18. java 9.0.1 Thank you! – Lord Loh. Oct 19 '17 at 1:41
  • worked, but this solution will be temporal until PPA maintainer updates the files permanently and applies the new version schema – logoff Oct 19 '17 at 8:19
  • Thanks, this also worked for me after many headaches trying to get it installed. – Blake Niemyjski Oct 20 '17 at 13:39
  • PPA works out of the box for now... Until something changes :-) – Lord Loh. Oct 21 '17 at 23:23
  • Still facing "dpkg: error processing package oracle-java9-installer (--configure): subprocess installed post-installation script returned error exit status 1" error – pd farhad Nov 6 '17 at 18:45

protected by Community Oct 19 '17 at 6:30

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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