wget downloading tar.gz file as html?

19,660

Solution 1

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"

Solution 2

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

<html>
<head>
<title>Unauthorized Request</title>
Share:
19,660
Atirag
Author by

Atirag

Updated on September 18, 2022

Comments

  • Atirag
    Atirag almost 2 years

    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?