Downloading Java JDK on Linux via wget is shown li

2019-01-02 21:46发布

When I try to download Java from Oracle I instead end up downloading a page telling me that I need agree to the OTN license terms.

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.

How can I download and install Java?

25条回答
康忙北鼻。
2楼-- · 2019-01-02 22:15

this command can download jdk8 tgz package at now (2018-09-06), good luck !

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
查看更多
西瓜君#
3楼-- · 2019-01-02 22:15

For those needing JCE8 as well, you can download that also.

curl -L -C - -b "oraclelicense=accept-securebackup-cookie" -O http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip

Or

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip
查看更多
未来富二代他爹
4楼-- · 2019-01-02 22:16

I solve this (for Debian based Linux distros) by making packages using java-package a few times (for various architectures), then distributing them internally.

The big plus side is that this method always works; no matter how crazy Oracle's web pages become. Oracle can no longer break my build!

The downside is that it's a bit more work to set up initially.

  • Download the tar.gz files manually in a browser (thus "accepting" their terms)
  • Run make-jpkg jdk-7u51-linux-x64.tar.gz. This creates oracle-java8-jdk_8_amd64.deb
  • Distribute it within your organization

For distribution over the Internet, I suggest using a password protected apt repository or provide raw packages using symmetric encryption:

passphrase="Hard to crack string. Use /dev/urandom for inspiration."
gpg --batch --symmetric --force-mdc --passphrase-fd 0 \
   oracle-java8-jdk_8_amd64.deb <<< "$passphrase"

Of course providing (unencrypted) .deb packages on the internet is probably a violation of your license agreement with Oracle, which states:

... Oracle grants you a ... license ... to reproduce and use internally the Software complete and unmodified for the sole purpose of running Programs"

On the receiving end, if you have a password protected apt repo, all you need to do is apt-get install it. If you have raw packages, download, decrypt and dpkg -i them. Works like a charm!

查看更多
几分曾经.
5楼-- · 2019-01-02 22:17

you should try:

wget \
        --no-cookies \
        --header "Cookie: oraclelicense=accept-securebackup-cookie" \
        http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/jdk-8u172-linux-x64.tar.gz \
        -O java.tar.gz
查看更多
等我变得足够好
6楼-- · 2019-01-02 22:17

latest tested,

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

Be aware that certificate check is disabled if you care about absolute security. : )

查看更多
手持菜刀,她持情操
7楼-- · 2019-01-02 22:18

Try

wget --no-cookies --header "Cookie: s_nr=1359635827494; s_cc=true; gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk6downloads-1902814.html; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin --no-check-certificate -O ./jdk-6u45-linux-x64-rpm.bin

if you are like me trying to get Oracle JDK 6.

source: Oracle JVM download using curl/wget

查看更多
登录 后发表回答