Can't install Oracle JDK 9
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)
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.*
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
I've just experienced the same problem and done the following:
cd /var/lib/dpkg/info/
- in all files
oracle-java9-installer.*
change version numbers 177->178 and SHA256SUM_TGZ to what you see on the official website 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
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.