Wget downloading tar.gz file as html

downloadtarwget

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?

Best Answer

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"

Related Question