Getting below errors from 17-jan 2018:
--2018-01-18 09:59:52-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 104.94.43.14
Connecting to download.oracle.com (download.oracle.com)|104.94.43.14|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
--2018-01-18 09:59:52-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1516269712_4add28cbea8b722e5136a80b8de32670
Connecting to download.oracle.com (download.oracle.com)|104.94.43.14|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
Commands we are executing to install java8 on Ubuntu:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
getting similar error for java7 and java9 as well.
Please take a look into this issue and let me know if any workaround
It seems, Oracle changed the policy to remove outdated updates pretty quickly these days (in this case: 8u151/8u152). Sadly, the ppa:webupd8team/java
-maintainers did not yet publish an updated version of their packages which matches the latest JDK release (8u161). They should, however, do this to change the download URLs for the respective JDK archives (as published by Oracle).
In case you need an urgent update and/or as a "temporary" workaround you can get the latest version of Oracle JDK via the following steps:
Create a tmp directory in your user home and download the current JDK update 161 via wget
.
mkdir ~/tmp
cd tmp
wget --continue --no-check-certificate --header "Cookie: oraclelicense=a" 'http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz'
Unpack it in the tmp
directory
tar -xf jdk-8u161-linux-x64.tar.gz
Clear out the old installation and move the contents extracted into jdk1.8...
to the system-wide JDK installation directory:
sudo rm -R /usr/lib/jvm/java-8-oracle
sudo mkdir /usr/lib/jvm/java-8-oracle
sudo mv jdk1.8.0_161/* /usr/lib/jvm/java-8-oracle
sudo chown -R root:root /usr/lib/jvm/java-8-oracle
Run:
sudo /etc/profile.d/jdk.sh
Check the current java version by running:
java -version
Note well: The URL used in step 1 points to a x64
JDK assuming a non-32bit system environment. You can easily change it by inspecting the official download page by Oracle.
Hope it helps (as a workaround).
There is one more workaround for this problem that I've used previously. For me this was simpler approach:
apt-get install oracle-java8-installer -y oracle-java8-set-default -y || true
cd /var/lib/dpkg/info
sudo sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' oracle-java8-installer.*
sudo sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.*
sudo sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.*
sudo sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.*
apt-get install oracle-java8-installer oracle-java8-set-default -y
Initially solution was published here: https://ubuntuforums.org/showthread.php?t=2374686&page=4&p=13731177#post13731177
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With