Downloading Java JDK through Script

Viewed 1555

I have been using the following to download JDK 8u112 via a script.

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz

Recently, it throws ERROR 404: Not found and when you go to the link, it shows the same text in Downloading Java JDK on Linux via wget is shown license page instead

I've also tried http://download.oracle.com/otn/java/jdk/8u112-b15/jdk-8u112-linux-x64.tar.gz but it throws 401 Authorization Error.

Is there a new work around on this?

2 Answers

This is not a direct answer to your question...but Here is how i get URL to latest jdk download URL

#!/bin/bash

jdkwebinstallerDownloadPage="https://www.oracle.com"$(curl -s https://www.oracle.com/technetwork/java/javase/downloads/index.html | unix2dos | grep "<a name=\"JDK8\"" | sed 's/^.*\<a name=\"JDK8\" href=//g' | sed -r 's/>.*//g' | sed s/\"//g)
## Above yields https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 

jdkinstallerDownloadURL=$(curl -s $jdkwebinstallerDownloadPage | grep windows | grep downloads | grep x64 | grep jdk | grep -v demos | sed -r 's/^.*https/https/g' | sed -r 's/\".*//g') 
## yields https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-windows-x64.exe  

I am now looking to how to download from this url using wget...given that i have cedentials to login into oracle's login webpage which is https://login.oracle.com/mysso/signon.jsp

Related