从 Oracle 存档页面 wget/curl 下载 Oracle Java 7 SDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44131983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:58:23  来源:igfitidea点击:

wget/curl download of Oracle Java 7 SDK from the Oracle Archive page

javacurlwget

提问by Dirk

There are plenty of posts on StackOverflow and other communities (AskUbuntu, Unix & Linux etc.) which provide advice on how to use wgetor cUrlto 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.

StackOverflow 和其他社区(AskUbuntu、Unix 和 Linux 等)上有很多帖子提供了有关如何使用wgetcUrl自动从 Oracle 网站下载 Java 发行版的建议。它们都涉及发送一个 cookie,它假装接受了许可协议,在真正的下载链接出现之前,人们通常必须手动接受许可协议。

However, none of these work for me when trying to download Java 7 SDK which recently has been moved to the Oracle Archive page.

但是,在尝试下载最近已移至Oracle 存档页面的Java 7 SDK 时,这些都不适合我。

If I go to this page, accept the license agreement manually and then copy a download link, it looks like this:

如果我转到此页面,手动接受许可协议,然后复制下载链接,如下所示:

http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

Note that it has otnin the middle while all the other posts are about URLs which are stored underotn-pub.

请注意,它otn位于中间,而所有其他帖子都是关于存储在otn-pub.

Using the usual way that worked for the otn-publinks looks like this:

使用适用于otn-pub链接的通常方式如下所示:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz

However, this does not work for the otntype of URL. Instead, wgetreturns:

但是,这不适用于otnURL 类型。相反,wget返回:

--2017-05-23 12:11:12--  http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 92.122.214.233, 92.122.214.217
Connecting to download.oracle.com (download.oracle.com)|92.122.214.233|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/akam/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz [following]
--2017-05-23 12:11:12--  https://edelivery.oracle.com/akam/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.0.39.115, 2a02:26f0:8f:29a::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.0.39.115|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://login.oracle.com/pls/orasso/orasso.wwsso_app_admin.ls_login?Site2pstoreToken=v1.2~CA55CD32~5B4FBD9FD4FC906722CB92CC3F7FA417B904138FD53F875C3FEFDF932EC5928D866C8B39EACAA55F28099E034BAC612F869C90A39B20E322E380F4A006B9668EAD35323A1C548EAD5D03EE8D6C772A88C049F024986DC6CCF546B00D347731F76BE786B96F0041610DEE7B6B4EAC27DCBE558B151B032973F065FC0367918B72DBCAB4B7FC920BAC4C13E820DFFE1761C5C473B6E0A4F0E94FABACDB40F02AD6B2BAB1D3F57371B14048557A0291AC3F12C73A30CAF4AAEB8A545475300A1ABBD60E2BF27FB1B11BC47DE91D0E918E04E4C4663632E98752BBC07671BBD21E7C6F73D78A8A66254579EC63B99716D999 [following]
--2017-05-23 12:11:12--  https://login.oracle.com/pls/orasso/orasso.wwsso_app_admin.ls_login?Site2pstoreToken=v1.2~CA55CD32~5B4FBD9FD4FC906722CB92CC3F7FA417B904138FD53F875C3FEFDF932EC5928D866C8B39EACAA55F28099E034BAC612F869C90A39B20E322E380F4A006B9668EAD35323A1C548EAD5D03EE8D6C772A88C049F024986DC6CCF546B00D347731F76BE786B96F0041610DEE7B6B4EAC27DCBE558B151B032973F065FC0367918B72DBCAB4B7FC920BAC4C13E820DFFE1761C5C473B6E0A4F0E94FABACDB40F02AD6B2BAB1D3F57371B14048557A0291AC3F12C73A30CAF4AAEB8A545475300A1ABBD60E2BF27FB1B11BC47DE91D0E918E04E4C4663632E98752BBC07671BBD21E7C6F73D78A8A66254579EC63B99716D999
Resolving login.oracle.com (login.oracle.com)... 209.17.4.8
Connecting to login.oracle.com (login.oracle.com)|209.17.4.8|:443... connected.
HTTP request sent, awaiting response... 401 Authorization Required

Username/Password Authentication Failed.

Looks like either they changed something regarding the authentication or it never worked before for links from the Oracle Archivepage (never tried that before).

看起来他们要么更改了有关身份验证的内容,要么以前从未对Oracle Archive页面中的链接起作用(以前从未尝试过)。

Any idea how I can download the most recent Oracle Java 7 SDK .tar.gz archive using wgetor cUrlor similar?

任何想法我怎么能下载.tar.gz中解开使用最新的Oracle的Java 7 SDKwgetcUrl或类似的?

采纳答案by Arun Ganesan

The oracle site asks you to login if you try to download JDK 7 from their archive. Hence the issue with the curl and wget. This is a recent change hope they can change this.

如果您尝试从他们的存档下载 JDK 7,oracle 站点会要求您登录。因此出现了 curl 和 wget 的问题。这是最近的变化,希望他们可以改变这一点。

Note: Oracle has changed their licensing policy so check that before you move ahead. Your JDK may not be free anymore

注意:Oracle 已经更改了他们的许可政策,因此在继续之前请先检查一下。您的 JDK 可能不再免费

回答by TGKL

wget has worked with the otn-pub link up until recently.It does seem that Oracle has changed something.

wget 一直使用 otn-pub 链接直到最近。Oracle 似乎确实改变了一些东西。

The closest workaround is to wget from another site that host it

最接近的解决方法是从托管它的另一个站点 wget

wget http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/jdk-7u80-linux-x64.tar.gz

回答by kixx

This curl command works for me:

这个 curl 命令对我有用:

curl -v -O -L -b oraclelicense=accept-securebackup-cookie http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-i586.rpm

options:

选项:

  • -v- just display additional info and HTTP headers on STDERR (you can skip this) or use -sfor silent run
  • -O- save response to disk (instead of sending it to STDOUT) or use -ofilenameto specify another path
  • -L- follow redirects
  • -b- enable cookie engine and pass in initial cookie oraclelicense=accept-securebackup-cookie
  • -v- 只在 STDERR 上显示附加信息和 HTTP 标头(你可以跳过这个)或使用-s进行静默运行
  • -O- 将响应保存到磁盘(而不是将其发送到 STDOUT)或使用-o文件名指定另一个路径
  • -L- 跟随重定向
  • -b- 启用 cookie 引擎并传入初始 cookie oraclelicense=accept-securebackup-cookie

The URL is lifted straight from the Oracle JDK download page

该 URL 是直接从 Oracle JDK 下载页面中提取的

回答by Shruthi C.J

Oracle doesn't allow download from archive link without login into the portal and also its not recommendable to use jdk from archive links.

Oracle 不允许在未登录门户的情况下从存档链接下载,也不建议从存档链接使用 jdk。

Check this link for more info: http://www.oracle.com/technetwork/java/javase/archive-139210.html

查看此链接以获取更多信息:http: //www.oracle.com/technetwork/java/javase/archive-139210.html