问题

当我尝试从Oracle下载Java时,我最终下载了一个页面,告诉我我需要同意OTN许可条款.

Sorry!

In order to download products from Oracle Technology Network you must agree to the OTN license terms.

Be sure that...

  • Your browser has "cookies" and JavaScript enabled.
  • You clicked on "Accept License" for the product you wish to download.
  • You attempt the download within 30 minutes of accepting the license.

如何下​​载并安装Java?



解决方法

为JDK 8u112更新

RPM:

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

TAR GZ:

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

使用curl的RPM:

 curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u112-b15/jdk-8u112-linux-x64.rpm > jdk-8u112-linux-x64.rpm

在上述所有情况下,'x64'的subst'i586'下载32位版本.

  • -j -> junk cookies
  • -k -> ignore certificates
  • -L -> follow redirects
  • -H [arg] -> headers

curl 可用于代替 wget .

JDK 7u79的更新

TAR GZ:

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

使用curl的RPM:

curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm > jdk-7u79-linux-x64.rpm

同样,请确保为要下载的版本指定正确的网址.您可以在此处找到网址: Oracle JDK下载网站

从2012年6月9日起的原始回答

如果您要使用 wget 从命令行下载Oracle JDK,有一个解决方法.运行 wget 命令,如下所示:

wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz"

请务必将下载链接替换为正在下载的版本的下载链接.




相关问题推荐