Skip to content

Instantly share code, notes, and snippets.

@hgomez
Created March 19, 2014 20:39
Show Gist options
  • Save hgomez/9650687 to your computer and use it in GitHub Desktop.
Save hgomez/9650687 to your computer and use it in GitHub Desktop.
wget to download Java 8
wget --continue --no-check-certificate -O jdk-8-linux-x64.tar.gz --header Cookie: oraclelicense=a http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-linux-x64.tar.gz
@devopseze
Copy link

Thanks

@StyleOfLW
Copy link

Thanks

@mister-grumbler
Copy link

Thanks!

@Opfour
Copy link

Opfour commented May 28, 2020

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u241-b07/1f5b5a70bf22433b84d0e960903adac8/jdk-8u241-linux-x64.tar.gz

2020-05-28 17:37:31 ERROR 404: Not Found.

@Opfour
Copy link

Opfour commented May 28, 2020

also tried the latest:
wget --continue --no-check-certificate https://download.oracle.com/otn/java/jdk/8u241-b07/1f5b5a70bf22433b84d0e960903adac8/jdk-8u241-linux-x64.tar.gz?AuthParam=1585407406_a8cffe5669b296011aa5166b19137155

no joy there either. Thanks again for keeping this up :)

@ilyesAj
Copy link

ilyesAj commented Jun 19, 2020

@Lerbytech
Copy link

Well, wget from oracle is not working as of today because Oracle is hungry for your data - they want you to fill company name, phone, country, address, heck even d**kpick would be great.

However, if you use temporary mailbox and put some false data (completely false, they don't check) they will send you email and download will be ok. Still, they srewed redirect after verification so I had to relogin.

Or go to https://github.com/frekele/oracle-java/releases/tag/8u201-b09 and download binary file from there. I tried both ways and there is no difference in files.

@gwshepard
Copy link

That's interesting, I am assuming that some of you may be using this approach in a Dockerfile, if so does someone have an example to resolve this issue?
ENV JAVA_VERSION 8u201
ENV JAVA_BUILD 8u201-b09
ENV JAVA_DL_HASH 2afa1c823912d97baa5e363b205ba8ec
RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"
http://download.oracle.com/otn-pub/java/jdk/${JAVA_BUILD}/${JAVA_DL_HASH}/jdk-${JAVA_VERSION}-linux-x64.tar.gz &&

It is an example

@himalayashinde
Copy link

I have used the below on 25-07-2020
It worked for me correctly....

sudo wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242980_a4634525489241b9a9e1aa73d9e118e6 -O jre-8u261-linux-x64.tar.gz

even the below one worked

sudo wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242980_a4634525489241b9a9e1aa73d9e118e6 -O jdk-8-linux-x64.tar.gz

@elsticky
Copy link

elsticky commented Aug 5, 2020

I have used the below on 25-07-2020
It worked for me correctly....

sudo wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242980_a4634525489241b9a9e1aa73d9e118e6 -O jre-8u261-linux-x64.tar.gz

even the below one worked

sudo wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/AutoDL?BundleId=242980_a4634525489241b9a9e1aa73d9e118e6 -O jdk-8-linux-x64.tar.gz

The URL for your JDK is the same as to your JRE. Can you correct the URL? I'm not sure where to get it myself

@Micket
Copy link

Micket commented Oct 20, 2020

1.8.0_271

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/GetFile/1.8.0_271-b09/61ae65e088624f5aaa0b1d2d801acb16/linux-i586/jdk-8u271-linux-x64.tar.gz

@artemp84
Copy link

artemp84 commented Jan 26, 2021

https://www.oracle.com/webapps/redirect/signon?nexturl=https://download.oracle.com/otn/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.tar.gz

That link quite obviously redirects to the login page. Here's a similar to the last one:

https://javadl.oracle.com/webapps/download/GetFile/1.8.0_281-b09/89d678f2be164786b292527658ca1605/linux-i586/jdk-8u281-linux-x64.tar.gz

Thank you! Second URL works!

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/GetFile/1.8.0_281-b09/89d678f2be164786b292527658ca1605/linux-i586/jdk-8u281-linux-x64.tar.gz

@iMactool
Copy link

iMactool commented Jun 1, 2021

https://www.oracle.com/webapps/redirect/signon?nexturl=https://download.oracle.com/otn/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.tar.gz

That link quite obviously redirects to the login page. Here's a similar to the last one:
https://javadl.oracle.com/webapps/download/GetFile/1.8.0_281-b09/89d678f2be164786b292527658ca1605/linux-i586/jdk-8u281-linux-x64.tar.gz

Thank you! Second URL works!

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/GetFile/1.8.0_281-b09/89d678f2be164786b292527658ca1605/linux-i586/jdk-8u281-linux-x64.tar.gz

666 Thank you!~~~~~~~~`

@abdultz
Copy link

abdultz commented Aug 7, 2021

Use this account to login:
mocayim482@awg5.com
Oracle123.

@Dividedby0KSJ
Copy link

Use this account to login:
mocayim482@awg5.com
Oracle123.

Not all heroes wear capes! the best hero for GitHub JDK Downloading!
thanks a million!

@paulknulst
Copy link

Use this account to login: mocayim482@awg5.com Oracle123.

thx :)

@hgomez
Copy link
Author

hgomez commented Nov 4, 2021

Guys, your discussion on this gist is amazing.
Congrats to all

@nchampenois
Copy link

Linux x64 Compressed Archive | 138.78 MB | jdk-8u301-linux-x64.tar.gz

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://javadl.oracle.com/webapps/download/GetFile/1.8.0_301-b09/d3c52aa6bfa54d3ca74e617f18309292/linux-i586/jdk-8u301-linux-x64.tar.gz

To build your url, go to oracle download page :

Copy the link, for example for current version at this time (2021-12) is 8u301

Manually extract vars to build working headless url :

FILE=jdk-8u301-linux-x64.tar.gz
VERSION=301-b09
HASH=d3c52aa6bfa54d3ca74e617f18309292
URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_$VERSION/$HASH/linux-i586/$FILE"
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" $URL

@neoacevedo
Copy link

It won't work. Oracle will redirect to download-failed.html and this page is what actually you will download.

@Lampe2020
Copy link

Lampe2020 commented Mar 8, 2022

Easiest way to download every older version of Java for every OS:
go to https://www.oracle.com/java/technologies/downloads/archive/ scroll down a bit and select your desired version and click on its download link. Then accept the agreements, wait for the grey download button to become green, then click on it. On the login page that will most likely pop up at this point, log in with any account details from https://bugmenot.com/view/oracle.com
Enjoy your download!

@hexufeng
Copy link

hexufeng commented Jul 6, 2022

It won't work. Oracle will redirect to download-failed.html and this page is what actually you will download.

yes, it does't work now !

@sampipe
Copy link

sampipe commented Jul 28, 2022

Just extending this example for others so you can always just download the latest jdk8 in one script. This if you need a version other than x64 tar gz you will have to update it.

#!/bin/bash -x

# Find Latest version on Oracle
LATEST_PAGE=https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html

# Get file list
wget $LATEST_PAGE

LATEST_VERSION=`grep 'Java SE Development Kit 8' javase8u211-later-archive-downloads.html | head -1 | sed 's/.*\(8u.*\)<.*/\1/'`
LATEST_PATCH=`echo $LATEST_VERSION | sed 's/8u//g'`
LATEST_URL=`grep data-file= javase8u211-later-archive-downloads.html | grep -E "jdk-$LATEST_VERSION-linux-x64.tar.gz" | sed "s/.*data-file='\(.*\)'/\1/"`
rm javase8u211-later-archive-downloads.html

echo "Downloading....."

FILE=jdk-${LATEST_VERSION}-linux-x64.tar.gz
VERSION=`echo $LATEST_URL | awk -F\/ '{print $7}' | sed 's/8u//g'`
HASH=`echo $LATEST_URL | awk -F\/ '{print $8}'`
URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_$VERSION/$HASH/linux-i586/$FILE"
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" $URL

@Lampe2020
Copy link

Not the official Oracle Java, but you can install openjdk-8-* on Linux to get a full Java 8.

@dnovak1
Copy link

dnovak1 commented Dec 14, 2022

Just extending this example for others so you can always just download the latest jdk8 in one script. This if you need a version other than x64 tar gz you will have to update it.

Thank you!

@sampipe
Copy link

sampipe commented Dec 14, 2022

I actually found I was downloading the LATEST -1 with my script above.. here is an update for the latest latest for x64 linux

LATEST_PAGE="https://www.oracle.com/java/technologies/downloads/#java8"
DOWNFILE=index.html

# Get file list
wget $LATEST_PAGE

LATEST_VERSION=`grep 'Java SE Development Kit 8' $DOWNFILE | head -1 | sed 's/.*\(8u.*\)<.*/\1/'`
LATEST_PATCH=`echo $LATEST_VERSION | sed 's/8u//g'`
LATEST_URL=`grep data-file= $DOWNFILE | grep -E "jdk-$LATEST_VERSION-linux-x64.tar.gz" | sed "s/.*data-file='\(.*\)'/\1/"`
rm $DOWNFILE

echo "Downloading....."

FILE=jdk-${LATEST_VERSION}-linux-x64.tar.gz
VERSION=`echo $LATEST_URL | awk -F\/ '{print $7}' | sed 's/8u//g'`
HASH=`echo $LATEST_URL | awk -F\/ '{print $8}'`
URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_$VERSION/$HASH/linux-i586/$FILE"
wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" $URL

@cimoreno
Copy link

@sampipe Your script worked wonderfully. I tried to tweak for jdk 11 but lack necessary skills to make it work right. Some of the code I can't wrap my head around. Have you by chance tried it for jdk 11?

@sampipe
Copy link

sampipe commented Jan 20, 2023

Sorry I don't have some at hand..it should be simple enough to work out but I'm off work for a week so couldn't have a look for prob near 10 days..

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