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?
Many end users use this to distribute Java Runtime to desktops and laptops but should be aware that it requires a license if it's being used for internal business operations, production or commercial purposes.
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.
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.
(Irani updated to my answer, but here's to clarify it all.)
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
See the downloads in oracle.com for more.
-c / --continue
Allows continuing an unfinished download.
--header "Cookie: oraclelicense=accept-securebackup-cookie"
Since 15th March 2014 this cookie is provided to the user after accepting the License Agreement and is necessary for accessing the Java packages in download.oracle.com. The previous (and first) implementation in 27th March 2012 made use of the cookie gpw_e24=http%3A%2F%2Fwww.oracle.com[...]
. Both cases remain unannounced to the public.
The value doesn't have to be "accept-securebackup-cookie
".
--no-cookies
The combination --no-cookies --header "Cookie: name=value"
is mentioned as the "official" cookie support, but not strictly required here.
curl -L -C - -b "oraclelicense=accept-securebackup-cookie" -O https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz
-L / --location
Required for cURL to redirect through all the mirrors.
-C / --continue-at -
See above. cURL requires the dash (-
) in the end.
-b / --cookie "oraclelicense=accept-securebackup-cookie"
Same as -H / --header "Cookie: ..."
, but accepts files too.
-O
Required for cURL to save files (see [author's comparison][8] for more differences).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With