There are plenty of posts/blogs which provide advice on how to use wget
or cUrl
to automate downloading a Java distribution from the Oracle website. They all involve sending a cookie which pretends that one accepted the license agreement which one usually has to to manually before the real download link appears. The command looks like : (as of now 8u144 is latest build)
wget --no-cookies --no-check-certificate --header "Cookie:oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jre-8u144-linux-i586.tar.gz"
This works really well. However, this does not work when downloading the jre's that are moved to the Oracle Archive page.
For example, when i want to download the archived jre version (say 8u121), with the appropriate jre download url the command is as below:
wget --no-cookies --no-check-certificate --header "Cookie:oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz"
Note that it has otn
in the middle while the latest release (URL) is stored underotn-pub
.
When I ran this command, wget
returns:
--2017-08-08 10:43:06-- http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7e a248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz
Resolving download.oracle.com... 149.135.81.170, 149.135.81.144
Connecting to download.oracle.com|149.135.81.170|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/akam/otn/java/jdk/8u121-b13/e9e7ea248e2c4 826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz [following]
--2017-08-08 10:43:06-- https://edelivery.oracle.com/akam/otn/java/jdk/8u121-b1 3/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.tar.gz
Resolving edelivery.oracle.com... 23.77.154.98, 2600:1415:11:4ab::2d3e, 2600:141 5:11:496::2d3e
Connecting to edelivery.oracle.com|23.77.154.98|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://login.oracle.com:443/oam/server/osso_login?Site2pstoreToken=v1 .2~370805C146117E1A86~B4E580D98359934FF22A94A8200436D40ED327548F295C9507C09CA6B0 115CA377A225B8382A2C1CFF89EA5A20A66E489D1CF613E08BAAB259447602AF266C566C29496E60 0B7FB75806339FF0C9EF54B976F1950C20FCEE2BCCCBCCDA3C427570C187298BCA21A9D8D2DCFDAE 650952CC5E9B144041D950E2FEC3E7376B476DB8C62BAE0DA78E0738FED0FE386A1B793FD8C5F75E 061FCEA3A1CD20E6598E54E27AC18E5386AB61D7D9A46159BCC8C2E55022BD299D7F0BA4436925EE DD13C72A8BA4A9E4F378C6A993707CAF2EE9E453090847FF4309C193F424B736493C89498202E101 D56B8DB02A58E40D450CF0F796D4E12963FDD17A4DCD844703896C52AD76DFD2B8474A693184B169 760FD931F59A2C46B56BF7 [following]
--2017-08-08 10:43:07-- https://login.oracle.com/oam/server/osso_login?Site2pst oreToken=v1.2~370805C146117E1A86~B4E580D98359934FF22A94A8200436D40ED327548F295C9 507C09CA6B0115CA377A225B8382A2C1CFF89EA5A20A66E489D1CF613E08BAAB259447602AF266C5 66C29496E600B7FB75806339FF0C9EF54B976F1950C20FCEE2BCCCBCCDA3C427570C187298BCA21A 9D8D2DCFDAE650952CC5E9B144041D950E2FEC3E7376B476DB8C62BAE0DA78E0738FED0FE386A1B7 93FD8C5F75E061FCEA3A1CD20E6598E54E27AC18E5386AB61D7D9A46159BCC8C2E55022BD299D7F0 BA4436925EEDD13C72A8BA4A9E4F378C6A993707CAF2EE9E453090847FF4309C193F424B736493C8 9498202E101D56B8DB02A58E40D450CF0F796D4E12963FDD17A4DCD844703896C52AD76DFD2B8474 A693184B169760FD931F59A2C46B56BF7
Resolving login.oracle.com... 209.17.4.8
Connecting to login.oracle.com|209.17.4.8|:443... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Authorization failed.
Looks like I need to provide the authentication details while downloading the archived versions.
Can anyone let me know how to set the authentication or how to download archived jre versions using wget ??
Thanks in advance. Sai.