##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget. | |
### You can download all the binaries one-shot by just giving the BASE_URL. | |
### Script might be useful if you need Oracle JDK on Amazon EC2 env. | |
### Script is updated for every JDK release. | |
### Features:- | |
# 1. Resumes a broken / interrupted [previous] download, if any. | |
# 2. Renames the file to a proper name with including platform info. | |
# 3. Downloads the following from Oracle Website with one shell invocation. | |
# a. Windows 64 and 32 bit; | |
# b. Linux 64 and 32 bit; | |
# c. API Docs; | |
# d. You can add more to the list of downloads are per your requirement. | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
## Latest JDK10 version is JDK10.0.2 released on 17th Jul, 2018. | |
BASE_URL_10=http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_ | |
declare -a PLATFORMS=("linux-x64_bin.tar.gz" "windows-x64_bin.exe" "doc-all.zip") | |
# declare -a PLATFORMS=("linux-x64_bin.rpm" "linux-x64_bin.tar.gz" "osx-x64_bin.dmg" "windows-x64_bin.exe" "solaris-sparcv9_bin.tar.gz" "doc-all.zip") | |
for platform in "${PLATFORMS[@]}" | |
do | |
# wget -c --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "${BASE_URL_9}${platform}" | |
curl -C - -LR#OH "Cookie: oraclelicense=accept-securebackup-cookie" -k "${BASE_URL_10}${platform}" | |
done | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
##### Earlier versions: | |
## 10.0.2 => http://download.oracle.com/otn-pub/java/jdk/10.0.2+13/19aef61b38124481863b1413dce1855f/jdk-10.0.2_ |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
##### curl variant: | |
## • -C OR --continue-at ==> continuation from the last download, if any. And -C - for auto-detection. | |
## • -L OR --location ==> follow requested page, if moved to a different location. | |
## • -O OR --remote-name ==> name the local file same as remote file name. | |
## • -# OR --progress-bar ==> displays transfer progress as a simple progress bar. [not to be used with -s] | |
## • -H OR --header ==> header/@file to be included in the request. | |
## • -R OR --remote-time ==> local file will get the remote file timestamp. | |
## • -s OR --silent ==> quiet mode. | |
## • -S OR --show-error ==> show errors, if any. | |
curl -C - -L -O -# -H "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz" | |
curl -C - -L -O -R -s -S -H "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-x64.tar.gz" | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
##### wget variant: | |
## • -c OR --continue ==> resume getting a partially-downloaded file | |
## • -O OR --output-file=FILE ==> write documents to FILE | |
## • --no-check-certificate ==> don't validate the server's certificate | |
## • --no-cookies ==> don't use cookies | |
## • --header ==> insert STRING among the headers | |
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz" | |
wget -c -O "jdk-8u141-linux-x64.tar.gz" --no-check-certificate --no-cookies --header \ | |
"Cookie: oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz" | |
## Other notes picked from https://gist.github.com/laertis/749e9832e8c904ccda2d207a9112e663 | |
## • --no-check-certificate | |
## Only required with wget 1.12 and earlier, which do not support | |
## Subject Alternative Name (SAN) certificates | |
## (mainly Red Hat Enterprise Linux 6.x and friends, such as CentOS). | |
## 1.13 was released in August 2011. | |
## • --no-cookies | |
## The combination --no-cookies --header "Cookie: name=value" is mentioned | |
## as the "official" cookie support, but not strictly required here. | |
## • --header "Cookie: oraclelicense=accept-securebackup-cookie" | |
## Since 15th March 2014 this cookie is provided to the user after accepting the License | |
## Agreementand 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. | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget / curl. | |
### You can download all the binaries one-shot by just providing one BASE_URL. | |
### Script might be useful if you need Oracle JDK on Amazon EC2 env. | |
### Script is updated for every JDK release. | |
### Features:- | |
# 1. Resumes a broken / interrupted [previous] download, if any. | |
# 2. Renames the file to a proper name with including platform info. | |
# 3. Downloads the following from Oracle Website with one shell invocation. | |
# a. Windows 64 and 32 bit; | |
# b. Linux 64 and 32 bit; | |
# c. API Docs; | |
# d. You can add more to the list of downloads are per your requirement. | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
## Latest JDK8 version is JDK8u171 released on 17th Jul, 2018. | |
BASE_URL_8=http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181 | |
JDK_VERSION=`echo $BASE_URL_8 | rev | cut -d "/" -f1 | rev` | |
declare -a PLATFORMS=("-linux-arm32-vfp-hflt.tar.gz" "-linux-arm64-vfp-hflt.tar.gz" "-linux-i586.rpm" "-linux-i586.tar.gz" "-linux-x64.rpm" "-linux-x64.tar.gz" "-macosx-x64.dmg" "-solaris-sparcv9.tar.Z" "-solaris-sparcv9.tar.gz" "-solaris-x64.tar.Z" "-solaris-x64.tar.gz" "-windows-i586.exe" "-windows-x64.exe" "-docs-all.zip") | |
# declare -a PLATFORMS=("-linux-x64.tar.gz" "-windows-x64.exe" "-docs-all.zip") | |
for platform in "${PLATFORMS[@]}" | |
do | |
### wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" "${BASE_URL_8}${platform}" | |
curl -C - -LR#OH "Cookie: oraclelicense=accept-securebackup-cookie" "${BASE_URL_8}${platform}" | |
done |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget. | |
### You can download all the binaries one-shot by just giving the BASE_URL. | |
### Script might be useful if you need Oracle JDK on Amazon EC2 env. | |
### Script is updated for every JDK release. | |
### Features:- | |
# 1. Resumes a broken / interrupted [previous] download, if any. | |
# 2. Renames the file to a proper name with including platform info. | |
# 3. Downloads the following from Oracle Website with one shell invocation. | |
# a. Windows 64 and 32 bit; | |
# b. Linux 64 and 32 bit; | |
# c. API Docs; | |
# d. You can add more to the list of downloads are per your requirement. | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
## Latest JDK9 version is JDK9.0.1 released on 16th Jan, 2018. | |
BASE_URL_9=http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_ | |
declare -a PLATFORMS=("linux-x64_bin.tar.gz" "windows-x64_bin.exe" "doc-all.zip") | |
# declare -a PLATFORMS=("linux-x64_bin.rpm" "linux-x64_bin.tar.gz" "osx-x64_bin.dmg" "windows-x64_bin.exe" "solaris-sparcv9_bin.tar.gz" "doc-all.zip") | |
for platform in "${PLATFORMS[@]}" | |
do | |
# wget -c --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "${BASE_URL_9}${platform}" | |
curl -C - -LR#OH "Cookie: oraclelicense=accept-securebackup-cookie" -k "${BASE_URL_9}${platform}" | |
done | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
##### Earlier JDK9 versions: | |
## 9u1 => http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_ | |
## 9u0 => http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_ |
##### Earlier JDK8 versions: | |
## 8u171 => http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171 | |
## 8u161 => http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161 | |
## 8u151 => http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151 | |
## 8u144 => http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144 | |
## 8u141 => http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141 | |
## 8u131 => http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131 | |
## 8u121 => http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121 | |
## 8u111 => http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111 | |
## 8u101 => http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101 | |
## v8u91 => http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91 | |
## v8u77 => http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77 | |
## v8u73 => http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73 | |
## v8u71 => http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71 | |
## v8u65 => http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65 | |
## v8u60 => http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60 | |
## v8u51 => http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51 | |
## v8u45 => http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45 | |
## v8u40 => http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40 | |
## v8u31 => http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31 | |
## v8u25 => http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25 | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### | |
##### Previous iteration commands [just for reference]: | |
wget -c -O "$JDK_VERSION$platform" --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
"${BASE_URL_8}${platform}" | |
curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "${BASE_URL_8}${platform}" | |
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### |
This comment has been minimized.
This comment has been minimized.
Thanks @opendevnet. That |
This comment has been minimized.
This comment has been minimized.
I'm new to GIT, sorry if this is breaking any kind of etiquette... Combined the two codes above into one script. Its smaller, but may be more difficult to read for some. It does indeed download the latest 1.7 & 1.8 JDK's as configured. Two questions:
-Inet Begin KSH Script!/bin/kshConfigurationMethod=curl Mainfor base in ${BASE[@]}; do |
This comment has been minimized.
This comment has been minimized.
@inetquestion, |
This comment has been minimized.
This comment has been minimized.
Guys, note the difference in the base URL: |
This comment has been minimized.
This comment has been minimized.
The current script should work fine. I tested it just now.
|
This comment has been minimized.
This comment has been minimized.
this one work to download JDK 8 Update 45 wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz 100%[======================================>] 173,271,626 2.12M/s in 74s 2015-06-06 01:21:16 (2.23 MB/s) - `jdk-8u45-linux-x64.tar.gz.1' saved [173271626/173271626] |
This comment has been minimized.
This comment has been minimized.
EPIC |
This comment has been minimized.
This comment has been minimized.
Really nice script. There is just one minor bug, because you cannot garantee that update version numbers stay below 99. ## this will break for update numbers > 99
JDK_VERSION=${BASE_URL_8: -8}
## FIX: extract last part of url (only valid if using bash)
JDK_VERSION=${BASE_URL_8##*/} |
This comment has been minimized.
This comment has been minimized.
BaseURL for Java 7u60 (if somebody needs that):
|
This comment has been minimized.
This comment has been minimized.
Example for OSX: curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "https://edelivery.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-macosx-x64.dmg" |
This comment has been minimized.
This comment has been minimized.
Thx! solved my problems. |
This comment has been minimized.
This comment has been minimized.
Line 25, add: "-linux-x64.rpm" "-linux-x86.rpm" |
This comment has been minimized.
This comment has been minimized.
Has anyone tried to do the same using windows |
This comment has been minimized.
This comment has been minimized.
Is there an easy way for a script to get a list of the available jdk versions? |
This comment has been minimized.
This comment has been minimized.
JDK 121 has released but this url does not seem to work http://download.oracle.com/otn-pub/java/jdk/8u121-b13/jdk-8u121-linux-x64.tar.gz. Anyone has any thought? |
This comment has been minimized.
This comment has been minimized.
It looks like they added some kind of hash to the path. |
This comment has been minimized.
This comment has been minimized.
Anyone have 7u80 URL by chance? |
This comment has been minimized.
This comment has been minimized.
@DrGirlfriend, |
This comment has been minimized.
This comment has been minimized.
It seems Oracle added some kind of hash to the download url like "e9e7ea248e2c4826b92b3f075a80e441" |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
You can get the real download URL's from the javascript array in the download page. That said, there seems to be something else going on as well now. I just regex match the full page source with e.g. "(http://download.*windows-i586.exe)" Sending the correct cookies, you will then get a redirect 302 to a location with an AuthParam hash Your URL must start with edelivery.oracle.com not the download.oracle.com as they've supplied, but is otherwise identical. |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
lol oracle broke something
|
This comment has been minimized.
This comment has been minimized.
Yes, now you have to get account on oracle.com to be able to download old version. http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html Downloading these releases requires an oracle.com account
|
This comment has been minimized.
This comment has been minimized.
@Alexhha having to create an account to download old software and breaking every Ansible java playbook in use is a new Feature You'll Love From Oracle™ |
This comment has been minimized.
This comment has been minimized.
@P7h I would recommend use sed to extract last part instead cut + 2 rev cmds Line 22: |
This comment has been minimized.
This comment has been minimized.
Has anyone figured out how to generate the hash code? |
This comment has been minimized.
This comment has been minimized.
@austinheap |
This comment has been minimized.
This comment has been minimized.
Still cannot figure out, anyone has a solution besides OpenJDK? |
This comment has been minimized.
This comment has been minimized.
you can still download latest Java version without OTN account. And the link (with generated hash code) you can get with help of this site https://lv.binarybabel.org/catalog/java/jdk8. |
This comment has been minimized.
This comment has been minimized.
The site is down :( does anyone have an alternative? |
This comment has been minimized.
This comment has been minimized.
I wrote a shell script to automatically download Oracle SE JDK, support RHEL/Debian/SUSE and their variants distrobutions. |
This comment has been minimized.
This comment has been minimized.
@ghost
|
This comment has been minimized.
This comment has been minimized.
It seems like Oracle has changed the way that java can be downloaded. You now need to have an oracle account and login before you can download some of the archived java versions. Does anyone have a bash script that is able to login as well as download these files? |
This comment has been minimized.
This comment has been minimized.
Hi guys, Some one has a specific version link like 7u131 b12. |
This comment has been minimized.
This comment has been minimized.
Hey guys, great resource! Does anyone has the download link for the latest jdk8 8u192 b12 release? Thanks! |
This comment has been minimized.
This comment has been minimized.
It looks like as of 2019-04-16 you do now have to log in to an oracle account. Anyone finding a work around? |
This comment has been minimized.
This comment has been minimized.
it doesnot work now. i tried below command, gives: 401 Authorization Required Username/Password Authentication Failed. wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn/java/jdk/8u211-b12/478a62b7d4e34b78b671c754eaaf38ab/jdk-8u211-linux-x64.tar.gz" -O jdk-8u211-linux-x64.tar.gz any command to sign in oracle account- accept the license agreement - download the jdk tar.gz from cli? The Oracle JDK License has changed for releases starting April 16, 2019. Oracle Java downloads now require logging in to an Oracle account to download Java updates, like the latest Oracle Java 8u211 / Java SE 8u212. Because of this I cannot update the PPA with the latest Java (and the old links were broken by Oracle). For this reason, THIS PPA IS DISCONTINUED (unless I find some way around this limitation). Oracle Java 8 is now stable. Below you'll find instructions on how to install it in Ubuntu / Linux Mint via a PPA repository. The PPA supports JDK8 for both 32bit and 64bit as well as ARM (ARM v6/v7 Hard Float ABI - there's no JDK 8 ARM Soft Float ABI archive available for download on Oracle's website). |
This comment has been minimized.
This comment has been minimized.
This is the official script you get from Oracle once an update has been found and selected from GUI
But it's not useful since the links seem not to follow a naming convention, so you always need to find the proper link first manually. Hope someone finds a better solution, having to manually update this once a month is a pain |
This comment has been minimized.
For reference, here is a
curl
equivalent: