Dowemo
0 0 0 0


Question:

There is this lovely answer on how to automate the download of the Java JDK on Linux:Downloading Java JDK on Linux via wget is shown license page instead

The method described no longer works. It seems Oracle has once again changed the restrictions on their download servers to block this method. I suppose they do not want Java to be used in autoscaling server systems like AWS. What are they thinking?

The specific command I am trying is to download the latest 7u51 version to an AWS server so I can install my web applications:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm"

This no longer gets around the OTN license agreement as noted in this closed answer:https://stackoverflow.com/a/21431491/2144836

Trying this from my browser, I see the download link is adding an additional authentication in a query parameter:

http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392853518_cb83fe47e04500eecccdb66722756fb3

Copying and pasting this link with the AuthParam into the wget call does not work either. My initial guess is that it is tied to a session or IP address.

It is not reasonable to try downloading this manually to a server (or to a hundred servers a hundred times a day), so I am hoping for a workaround that will work with the current restrictions.

So TODAY, is there a workaround for automating the download of the latest JDK? Or should I just give up on Oracle entirely?


Best Answer:


Your command works just fine for me. Check below:

$ ls jdk*
ls: cannot access jdk*: No such file or directory
$ wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm"
--2014-02-20 14:03:49--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm
Resolving download.oracle.com... 23.11.235.25, 23.11.235.43
Connecting to download.oracle.com|23.11.235.25|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm [following]
--2014-02-20 14:03:50--  https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm
Resolving edelivery.oracle.com... 23.35.70.140
Connecting to edelivery.oracle.com|23.35.70.140|:443... connected.
WARNING: certificate common name `www.oracle.com' doesn't match requested host name `edelivery.oracle.com'.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392885351_97435f8939e97d11f6065b4147ddbae9 [following]
--2014-02-20 14:03:50--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm?AuthParam=1392885351_97435f8939e97d11f6065b4147ddbae9
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 121271382 (116M) [application/x-redhat-package-manager]
Saving to: `jdk-7u51-linux-i586.rpm'
100%[=================================================================================================================================>] 12,12,71,382  381K/s   in 4m 14s  
2014-02-20 14:08:04 (466 KB/s) - `jdk-7u51-linux-i586.rpm' saved [121271382/121271382]
$ ls -l jdk*
-rw-r--r-- 1 root root 121271382 2014-02-11 00:10 jdk-7u51-linux-i586.rpm

What error do you get when you run this command? I tried your command in 3 different places and it worked every time.




Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs