4

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?

Community
  • 1
  • 1
  • The answer in this question (https://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead) is updated and working again! – MYeung May 24 '16 at 06:14

3 Answers3

2

Oracle has made changes that impact previous approaches.

The correct answer for March 2014 is here:

Downloading Java JDK on Linux via wget is shown license page instead

Community
  • 1
  • 1
spkane
  • 6,177
  • 2
  • 18
  • 18
1

Automating the process of downloading java, changing permission to execute, & installing it.

OS :- CentOS

gedit abc

//created a bash file called abc and copy below script starting from [ #!/bin/bash till rpm -ivh jdk-8u31-linux-x64.rpm ] to abc file.

#!/bin/bash

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

chmod +xr jdk-8u31-linux-x64.rpm

rpm -ivh jdk-8u31-linux-x64.rpm

//save the file and exit

give permission to abc file to execute [ chmod +xr abc ]

run the file ./abc

Manoj
  • 11
  • 1
0

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.

slayedbylucifer
  • 22,878
  • 16
  • 94
  • 123
  • I was getting timeouts: --2014-02-19 23:30:41-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm Resolving download.oracle.com (download.oracle.com)... 23.0.160.198, 23.0.160.209 Connecting to download.oracle.com (download.oracle.com)|23.0.160.198|:80... failed: Connection timed out. Connecting to download.oracle.com (download.oracle.com)|23.0.160.209|:80... failed: Connection timed out. Retrying. [repeat several times] This morning, it works again. Although now the IP address resolution changed. I wonder if this was a transient network problem or something else. – Richard J. Barbalace Feb 20 '14 at 15:16
  • On further exploration, I notice that trying to use the new AuthParam on another server fails, so continue to leave that out. It seems not needed. – Richard J. Barbalace Feb 20 '14 at 15:54
  • It does look like the old method is no longer working in general. Maybe it is an update that was being slowly deployed to their servers. Looking for another work around. – spkane Mar 18 '14 at 23:10