Skip to content

Instantly share code, notes, and snippets.

Last active October 6, 2021 09:58
What would you like to do?
Oracle JVM download using curl/wget
# Downloading Oracle JVM without browser
Oracle requires you to accept its licence agreement before downloading its JVM.
It's a pain for those of us who do automation, native packages, Jenkins JVM deployment on slave...
I used Firefox and Firebug to sniff network exchanges.
## HTTP Request :
GET /otn-pub/java/jdk/6u39-b04/jdk-6u39-linux-i586.bin?AuthParam=1359814101_9685f919f8b3113a89574ec4570d47b2 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: s_nr=1359635827494; s_cc=true;; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value
Connection: keep-alive
# Using curl
curl -L --header "Cookie: s_nr=1359635827494; s_cc=true;; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value" -o jdk-6u39-linux-x64.bin
curl -L --header "Cookie: s_nr=1359635827494; s_cc=true;; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value" -o jdk-6u41-linux-x64.bin
# Using wget
wget --no-cookies --header "Cookie: s_nr=1359635827494; s_cc=true;; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value"
wget --no-cookies --header "Cookie: s_nr=1359635827494; s_cc=true;; s_sq=%5B%5BB%5D%5D; gpv_p24=no%20value"
You should be able to download Oracle JVMs from anywhere now.
Thanks to Kevin Decherf blog (, where I found to avoid injecting cookies but use a specific header
Copy link

For me just

curl -L -b "oraclelicense=a" -O

was ok...

In order to download some other version, just substitude with the correct url - you can see it on the page.

Copy link

Is there a way to download the embedded jre version this way also?
none of the methods seems to work with packages not in the 'otn-pub' folder

Copy link

Thanks a ton @ivajloip

Copy link

pythys commented Mar 25, 2017

For anyone reading this, the suggestion from @ivajloip is the best and simplest solution. More specifically, the whole magic is in the flag -b "oraclelicense=a". Just pass that to any oracle JDK you want to download and that's it, no need for that big cookie string using --header or anything like that

Copy link

sdmcraft commented Jul 12, 2017

Thanks @ivajloip. An example would be
curl -L -b "oraclelicense=a" -O

Here's a script for downloading and setting up java:

Copy link

sirgatez commented Feb 6, 2018

@ivajloip Your tip works like a charm. I'm able to download JDKs automatically without issue. 👍 :-D

Copy link

@ivajloip How about downloading JDKs from archive page? I want to download JDK1.8_161

Copy link

Unfortunatly this method is only possible for otn-pub downloads.

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