6

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

1
  • 1
    I can confirm the 404, experienced the same problem today. Maybe just wait 1 or 2 days, until the webmaster at Oracle has scanned the log files for 404 more closely. Commented Jan 18, 2018 at 13:09

2 Answers 2

3

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:

  1. 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' 
    
  2. Unpack it in the tmpdirectory

    tar -xf jdk-8u161-linux-x64.tar.gz 
    
  3. 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
    
  4. Run:

    sudo /etc/profile.d/jdk.sh
    
  5. 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).

Sign up to request clarification or add additional context in comments.

2 Comments

In the meantime, 8u161 is available via ppa:webupd8team/java repository. Still, this solution will work for future versions, most likely 8u171, 8u181 etc.
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.