Unable to download Oracle JDK 8 using Wget command

0

I have been trying to download "jdk-8u211-linux-x64.tar.gz" from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html? with the below command. The file gets downloads but not the correct one. As when I do file jdk-8u221-linux-i586.tar.gz it is showing as html file.

command: wget --user=*** --password=******* --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn/java/jdk/8u221-b11/230deb18db3e4014bb8e3e8324f81b43/jdk-8u221-linux-x64.tar.gz"

And when I try to unzip it using tar -xvzf jdk-8u221-linux-i586.tar.gz I get below error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

mansing shinde

Posted 2019-08-01T12:40:23.290

Reputation: 5

You are getting the HTML file because typically you have to agree to their license before downloading. You might want to look at how the webupd8.org people do it for their apt based installer. – ivanivan – 2019-08-01T13:10:08.600

Actually, @ivanivan, Oracle locked down the Java downloads and doesn't let anyone, including WebUpd8, download it outside of their approved flow.

– Deltik – 2019-08-01T13:12:02.857

@Deltik good to know, think you ought to add a little more and make it an Answer. – ivanivan – 2019-08-01T13:12:36.287

@ivanivan: Sure, here's an answer.

– Deltik – 2019-08-01T13:18:39.723

@mansing shinde: Here is how to do it (at least it worked for me): https://stackoverflow.com/a/10959815/2184122

– Robert Lugg – 2020-01-07T19:08:58.773

Answers

1

Following a licensing change of Oracle Java on 16 April 2019, Oracle now forbids anyone from downloading Java outside of their approved process.

That process is currently to log in to an Oracle account, accept the new license, then attempt the download with the authentication cookies in place.

WebUpd8 had to shut down their Oracle Java PPA for this exact reason.

If you have the right cookies, you can technically set them in your wget headers, but you would have to browse to the download in your web browser and then copy the request that the browser is making. At that point, you might as well download Java with your browser.

There are no known workarounds at this time.

Deltik

Posted 2019-08-01T12:40:23.290

Reputation: 16 807

Thank you for your prompt response, I already tried logging to Oracle site and then accept the license agreement and copy the download url with wget. I am not sure how do I find the right cookies, would you able to shed some light on that please? Do I need to go in developer mode of Browser and get the cookie from there? – mansing shinde – 2019-08-02T03:40:48.663

1I have managed to get it installed. I logged to Oracle, accepted the license and clicked on "jdk-8u221-linux-x64.tar.gz" download link and it started downloading the file, at the same time you get URL in the developer mode of the browser in console tab that looks like below.


then did wget <URL> and worked.

Thank you. I have accepted your answer. – mansing shinde – 2019-08-02T04:12:03.937

0

download jdk 8u221

$ wget -c --content-disposition "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=239835_230deb18db3e4014bb8e3e8324f81b43"
$ old=$(ls -hat | grep jre | head -n1)
$ mv $old $(echo $old | awk -F"?" '{print $1}')

my blog 044-wget下载jdk8u221

AnJia

Posted 2019-08-01T12:40:23.290

Reputation: 1