使用wget下载jdk失败

命令:

wget --no-cookies --no-check-certificate http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz

错误:

--2015-08-26 01:43:19--  http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz
Resolving download.oracle.com... 165.254.202.218, 165.254.202.210
Connecting to download.oracle.com|165.254.202.218|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz [following]
--2015-08-26 01:43:19--  https://edelivery.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz
Resolving edelivery.oracle.com... 23.6.118.140
Connecting to edelivery.oracle.com|23.6.118.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/errors/download-fail-1505220.html [following]
--2015-08-26 01:43:19--  http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com|165.254.202.218|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: `download-fail-1505220.html'

100%[====================================================>] 5,307       --.-K/s   in 0s      

2015-08-26 01:43:19 (571 MB/s) - `download-fail-1505220.html' saved [5307/5307]

原因: 直接在页面下载时需要click接受oraclelicence。而上面命令没有附加相应的cookie.

 解决办法:加上相应的cookie:  oraclelicense=accept-securebackup-cookie

 正确命令:

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz

 

发表评论