Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### 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}"
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
@opendevnet

This comment has been minimized.

opendevnet commented Sep 18, 2014

For reference, here is a curl equivalent:

curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "https://edelivery.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-i586.tar.gz"
@P7h

This comment has been minimized.

Owner

P7h commented Oct 17, 2014

Thanks @opendevnet. That curl variant looks cool.

@inetquestion

This comment has been minimized.

inetquestion commented Mar 19, 2015

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:

  1. How do you know what those URLs will be?
  2. Can you do this for the JRE as well?

-Inet

Begin KSH Script

!/bin/ksh

Configuration

Method=curl
HOST=http://download.oracle.com/otn-pub/java/jdk
set -A BASE /8u40-b26/jdk-8u40 /7u75-b13/jdk-7u75
set -A PLATFORMS -- -windows-x64.exe -windows-i586.exe -linux-x64.tar.gz -linux-i586.tar.gz

Main

for base in ${BASE[@]}; do
for platform in ${PLATFORMS[@]}; do
BASE_URL=${HOST}${base}
echo Downloading: ${BASE_URL: -8}${platform}
case $Method in
curl) curl -sS -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "${HOST}${base}${platform}" ;;
wget) wget -c --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "${HOST}${base}${platform}" ;;
*) print "ERROR: Invalid download method. Valid choices for 'Method' are: [wget|curl]." ; exit 1 ;;
esac
done
done

@P7h

This comment has been minimized.

Owner

P7h commented Apr 17, 2015

@inetquestion,
I usually check the Oracle website for the URL path of the new version; more so specifically for the build number of the JDK version.
You can add JRE as well to the list "set -A PLATFORMS" in your script.

@shlomoa

This comment has been minimized.

shlomoa commented Apr 18, 2015

Guys, note the difference in the base URL:
Works: https://edelivery.oracle.com/otn-pub/java/jdk/
Doesn't: http://download.oracle.com/otn/java/jdk/

@P7h

This comment has been minimized.

Owner

P7h commented Apr 20, 2015

@shlomoa,

The current script should work fine. I tested it just now.
Please check the below snippet:


--2015-04-20 12:22:40-- http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-docs-all.zip
Resolving download.oracle.com (download.oracle.com)... 109.159.157.80, 109.159.157.83
Connecting to download.oracle.com (download.oracle.com)|109.159.157.80|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-docs-all.zip
[following]
--2015-04-20 12:22:41-- https://edelivery.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-docs-all.zip
Resolving edelivery.oracle.com (edelivery.oracle.com)... 92.123.187.92
Connecting to edelivery.oracle.com (edelivery.oracle.com)|92.123.187.92|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-docs-all.zip?AuthParam=1429529081_09197320d72156a47ddce1fab3d7aff1 [following]
--2015-04-20 12:22:41-- http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-docs-all.zip?AuthParam=1429529081_09197320d72156a47ddce1fab3d7aff1
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 61119563 (58M) [application/zip]
Saving to: ‘jdk-7u79-docs-all.zip’

@dedetok

This comment has been minimized.

dedetok commented Jun 5, 2015

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
--2015-06-06 01:20:00-- http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 103.31.45.10, 103.31.45.8
Connecting to download.oracle.com (download.oracle.com)|103.31.45.10|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz [following]
--2015-06-06 01:20:00-- https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.212.126.81
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.212.126.81|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz?AuthParam=1433500013_a2bcbce00278f3b31df0e829faa05da2 [following]
--2015-06-06 01:20:01-- http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz?AuthParam=1433500013_a2bcbce00278f3b31df0e829faa05da2
Connecting to download.oracle.com (download.oracle.com)|103.31.45.10|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 173271626 (165M) [application/x-gzip]
Saving to: `jdk-8u45-linux-x64.tar.gz.1'

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]

@rodgermoore

This comment has been minimized.

rodgermoore commented Aug 7, 2015

EPIC

@TomNussbaumer

This comment has been minimized.

TomNussbaumer commented Sep 10, 2015

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##*/}
@MatthiasLohr

This comment has been minimized.

MatthiasLohr commented Nov 12, 2015

BaseURL for Java 7u60 (if somebody needs that):

http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60
@Michaelangel007

This comment has been minimized.

Michaelangel007 commented Jan 10, 2016

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"

@lasclocker

This comment has been minimized.

lasclocker commented Apr 6, 2016

Thx! solved my problems.

@tibers

This comment has been minimized.

tibers commented Apr 21, 2016

Line 25, add: "-linux-x64.rpm" "-linux-x86.rpm"

@antonevane

This comment has been minimized.

antonevane commented May 11, 2016

Has anyone tried to do the same using windows bitsadmin utility.

@SKelem

This comment has been minimized.

SKelem commented Nov 10, 2016

Is there an easy way for a script to get a list of the available jdk versions?

@gdbtek

This comment has been minimized.

gdbtek commented Jan 17, 2017

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?

@CODYQX4

This comment has been minimized.

CODYQX4 commented Jan 18, 2017

It looks like they added some kind of hash to the path.

@DrGirlfriend

This comment has been minimized.

DrGirlfriend commented Jan 27, 2017

Anyone have 7u80 URL by chance?

@nerro

This comment has been minimized.

nerro commented Feb 11, 2017

@dukas

This comment has been minimized.

dukas commented Feb 24, 2017

It seems Oracle added some kind of hash to the download url like "e9e7ea248e2c4826b92b3f075a80e441"
so links like
http://download.oracle.com/otn-pub/java/jdk/8u121-b13/jdk-8u121-linux-x64.tar.gz
won't work anymore.

@jlrigau

This comment has been minimized.

jlrigau commented Mar 10, 2017

👍

@mgallig

This comment has been minimized.

mgallig commented Apr 13, 2017

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.
You'll get a redirect to a url with an authparam parameter next (this is likely different every time)

http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jre-8u121-windows-x64.exe?AuthParam=1492095708_605c40753ae1f76391752f66815963ec

@marcuslang

This comment has been minimized.

marcuslang commented May 24, 2017

👍

@knope

This comment has been minimized.

knope commented May 25, 2017

lol oracle broke something wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz

--2017-05-25 12:56:28--  http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 184.51.148.130, 184.51.148.122
Connecting to download.oracle.com (download.oracle.com)|184.51.148.130|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz [following]
--2017-05-25 12:56:28--  https://edelivery.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.90.82.236, 2600:141b:2000:1a1::2d3e, 2600:141b:2000:190::2d3e
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.90.82.236|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz?AuthParam=1495717108_a3711913bb9002a3938a746a49b4f4c4 [following]
--2017-05-25 12:56:28--  http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz?AuthParam=1495717108_a3711913bb9002a3938a746a49b4f4c4
Connecting to download.oracle.com (download.oracle.com)|184.51.148.130|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-25 12:56:30 ERROR 404: Not Found.
@Alexhha

This comment has been minimized.

Alexhha commented May 25, 2017

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

$ curl -i http://download.oracle.com/otn/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
HTTP/1.1 302 Moved Temporarily
Server: AkamaiGHost
Content-Length: 0
Location: https://edelivery.oracle.com/akam/otn/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
Date: Thu, 25 May 2017 14:52:10 GMT
Connection: keep-alive
@austinheap

This comment has been minimized.

austinheap commented May 25, 2017

@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

@gonzalesraul

This comment has been minimized.

gonzalesraul commented May 26, 2017

@P7h I would recommend use sed to extract last part instead cut + 2 rev cmds

Line 22:
JDK_VERSION=echo $BASE_URL_8 | sed -r "s#.+/##"

@n0rbs

This comment has been minimized.

n0rbs commented May 29, 2017

Has anyone figured out how to generate the hash code?

@Alexhha

This comment has been minimized.

Alexhha commented May 29, 2017

@austinheap
Exactly. Have to switch to OpenJDK.

@kkadir

This comment has been minimized.

kkadir commented Jun 6, 2017

Has anyone figured out how to generate the hash code?

Still cannot figure out, anyone has a solution besides OpenJDK?

@nerro

This comment has been minimized.

nerro commented Jun 6, 2017

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.

@krummler

This comment has been minimized.

krummler commented Jul 6, 2017

The site is down :( does anyone have an alternative?

@ghost

This comment has been minimized.

ghost commented Sep 22, 2017

I wrote a shell script to automatically download Oracle SE JDK, support RHEL/Debian/SUSE and their variants distrobutions.
I created a version selection menu to support both Java 9 and Java 8 installation, add sha256 hash check to make source package is verified and authorized.
With parameter -h will list help info about the usage of the script.
Github url is https://github.com/MaxdSre/ShellScript/blob/master/assets/software/OracleSEJDK.sh.

@taurus227

This comment has been minimized.

taurus227 commented Oct 20, 2017

@ghost
Your script worked like a charm!
However, maybe it would be better if /usr/lib/jvm/default-java would link to the same location as JAVA_HOME, namely /opt/OracleJDK?

$ echo $JAVA_HOME
/opt/OracleJDK

$ sudo update-java-alternatives -l
awk: fatal: cannot open file `/usr/lib/jvm/*.jinfo' for reading (No such file or directory)
default-java                              /usr/lib/jvm/default-java

$ ls -l /usr/lib/jvm/ | grep java
lrwxrwxrwx 1 root root   24 Feb 25  2016 default-java -> java-1.8.0-openjdk-amd64
drwxr-xr-x 2 root root 4096 Aug  2 09:25 java-8-oracle
@jonmaloney

This comment has been minimized.

jonmaloney commented Jan 19, 2018

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?

@ShinJR

This comment has been minimized.

ShinJR commented Jul 17, 2018

Hi guys, Some one has a specific version link like 7u131 b12.

@thorsten-plause

This comment has been minimized.

thorsten-plause commented Oct 25, 2018

Hey guys, great resource! Does anyone has the download link for the latest jdk8 8u192 b12 release? Thanks!
Edited: 8u192 b12 link: http://download.oracle.com/otn-pub/java/jdk/8u192-b12/750e1c8617c5452694857ad95c3ee230/server-jre-8u192-linux-x64.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment