Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JDK8 command line download script; For JDK10, please check: https://gist.github.com/P7h/9741922
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### 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
##### 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}"
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
@apiOmat

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.