I need to download this file http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz using wget.

I use the command

wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

The file gets downloaded but when I try to untar that file I get this

tar -zxvf jdk-7u67-linux-x64.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

So I use the file command to check on the file and I get this

file jdk-7u67-linux-x64.tar.gz
jdk-7u67-linux-x64.tar.gz: HTML document, ASCII text, with very long lines, with CRLF line terminators

I'm on Ubuntu 14.04. Any ideas?

3 Answers 3


Check the file size. You're probably actually getting back HTML. Oracle does not give you the jdk download unless you check the checkbox accepting their terms. (If you look at the reponse headers, you're probably getting back Content: text/html)

You can accept the terms by providing the following header:

--no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"


Look into the file using less and you'll find this:

<title>Unauthorized Request</title>
wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz -O

This will let you download it as a .tar.gz

Look at the section of the manual for -O or --output-file=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.