Unable to install java8 using PPA repository on ubuntu 16.04

Abhijeet Kale :

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

MWiesner :

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).

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=469276&siteId=1