Downloading Java Jdk on Linux Via Wget Is Shown License Page Instead

Downloading Java JDK on Linux via wget is shown license page instead

Works as of December 23rd, 2021 for JDK 17

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/17/archive/jdk-17.0.1_linux-x64_bin.rpm

Works as of July 27th, 2021 for JDK 16

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/16.0.2%2B7/d4a915d82b4c4fbb9bde534da945d746/jdk-16.0.2_linux-x64_bin.rpm

Works as of November 5th, 2020 for JDK 15

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/15.0.1+9/51f4f36ad4ef43e39d0dfdbaf6549e32/jdk-15.0.1_linux-x64_bin.rpm

Works as of 07-11-2020 for JDK 14

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/14.0.1+7/664493ef4a6946b186ff29eb326336a2/jdk-14.0.1_linux-x64_bin.rpm -O ~/Downloads/jdk-14.0.1_linux-x64_bin.rpm

PS: Alf added this ( me ) :-) this, I couldn't figured out how to just commented at the end... Enjoy it.

UPDATED FOR Oracle JDK 11

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.tar.gz

UPDATED FOR JDK 10.0.2

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_linux-x64_bin.tar.gz

UPDATED FOR JDK 10.0.1

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz

UPDATED FOR JDK 9
it looks like you can download it now directly from java.net without sending a header

wget http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz

UPDATED FOR JDK 8u191

TAR GZ:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3a%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk8-downloads-2133151.html; oraclelicense=accept-securebackup-cookie;" "https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz"

RPM:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3a%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk8-downloads-2133151.html; oraclelicense=accept-securebackup-cookie;" "https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.rpm"

UPDATED FOR JDK 8u131

RPM:

  wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

TAR GZ:

 wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

RPM using curl:

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

In all cases above, subst 'i586' for 'x64' to download the 32-bit build.

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

curl can be used in place of wget.

UPDATE FOR 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

RPM using curl:

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

Once again, make sure you specify the correct URL for the version you are downloading. You can find the URL here: Oracle JDK download site

ORIGINAL ANSWER FROM 9th June 2012

If you are looking to download the Oracle JDK from the command line using wget, there is a workaround. Run the wget command as follows:

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"

Be sure to replace the download link with the correct one for the version you are downloading.

Not able to install oracle jdk on CentOS machine using wget

Updated September 17th, 2021

Oracle has decided to change JDK license. See the official blog post.

Among other things it now allows to download JDK from scripts without any need for storing specific hashes or accepting a license agreement. There is also a page "JDK 17 Script Friendly URLs" with usage examples for scripts. Here is an excerpt from that page:

For example, to retrieve the current JDK 17 update release for Linux x64 as a compressed (tar.gz) archive, you can use the wget command:

wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

or with curl:

curl https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

The checksum for the release can be found by adding .sha256 to the download URL:

https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz.sha256

These URLs will deliver the GA version of JDK 17 and its checksum until the release of the first Critical Patch Update. When 17.0.1 is released the above URLs will deliver 17.0.1 until the release of the 17.0.2 at which point the above URLs will deliver 17.0.2 and so on.

=== Previous version of the answer below ===

Oracle has updated links generation mechanism. It now includes some sequence, which seems to be persistent for a version but generated with a yet unknown mechanism.
Also, to download any version except for latest you're now required to have Oracle account:

For production use Oracle recommends downloading the latest JDK and
JRE versions and allowing auto-update.

Only developers and Enterprise administrators should download these
releases.

Downloading these releases requires an oracle.com account. If you
don't have an oracle.com account you can use the links on the top of
this page to learn more about it and register for one for free.

See more at Oracle Java Archives page.

So you're stuck with two options now.

Option 1. Use the latest version (8u131 now) by a new direct link.
The link is available at the Java SE Development Kit 8 downloads page after you accept the License agreement. And your command will be:

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/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm"

Option 2. Switch to openjdk package:

yum install java-1.8.0-openjdk

See more about openjdk installation at OpenJDK: Download and install page.

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

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.

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

Download a JDK installer with wget in a batch file

Compare the URLs from your output.

The CLI URL contains a percentage sign %2B as part of a URL-encoded letter. But the batch script output is missing this percentage sign, therefore leading to a wrong URL.

  • CLI output 15.0.1%2B9
  • Batch output 15.0.1B9

Since batch uses the percentage sign % to identify variables you have to escape it, if you want to use it literally.

Therefore, try using two percentage signs in your batch script %%. This should lead to a (correct) single % in your URL.



Related Topics



Leave a reply



Submit