Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to install Java 1.7_51 on Debian Wheezy with:

apt-get install oracle-java7-installer=7u51-0~webupd8~1

from: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html

In past it was OK, now I've deleted my old 1.7_45 and want a fresh 1.7_51 but in some wierd way installation fails.

Installation download few files, one of them is jdk-7u51-linux-x64.tar.gz, which is error page HTML. See below output lines with:

HTTP request sent, awaiting response... 200 OK Length: 5307 (5.2K)

[text/html] Saving to: `jdk-7u51-linux-x64.tar.gz'

How to install it?

Below I am presenting contents of command output (http://pastebin.com/gPBCivvU):

$ sudo apt-get install oracle-java7-installer=7u51-0~webupd8~1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  binfmt-support visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming firefox firefox-2 iceweasel mozilla-firefox iceape-browser mozilla-browser
  epiphany-gecko epiphany-webkit epiphany-browser galeon midbrowser moblin-web-browser xulrunner xulrunner-1.9 konqueror chromium-browser midori google-chrome
The following NEW packages will be installed:
  oracle-java7-installer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/17.6 kB of archives.
After this operation, 110 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package oracle-java7-installer.
(Reading database ... 41559 files and directories currently installed.)
Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~1_all.deb) ...
Processing triggers for shared-mime-info ...
Setting up oracle-java7-installer (7u51-0~webupd8~1) ...
Downloading Oracle Java 7...
--2014-03-15 18:02:52--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 84.53.175.152, 84.53.175.146
Connecting to download.oracle.com (download.oracle.com)|84.53.175.152|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz [following]
--2014-03-15 18:02:52--  https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 172.227.102.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|172.227.102.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2014-03-15 18:02:53--  http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com (download.oracle.com)|84.53.175.152|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: `jdk-7u51-linux-x64.tar.gz'

     0K                                                      100%  387M=0s

2014-03-15 18:02:53 (387 MB/s) - `jdk-7u51-linux-x64.tar.gz' saved [5307/5307]

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-linux-x64.tar.gz
Oracle JDK 7 is NOT installed.
dpkg: error processing oracle-java7-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
share|improve this question

It looks like the download is failing because it redirects to this page: http://download.oracle.com/errors/download-fail-1505220.html

The page indicates that Oracle thinks you didn't accept the license. So I think they (Oracle) changed something in their download procedures and now the webupd8 installed package you're using is unable to access the file directly.

Edit: Based on the download method of @dmourati below if you have the file you can place it in "/var/cache/oracle-jdk7-installer/", if the file is available there the installer package will skip the download and complete the installation for you.

share|improve this answer
    
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "download.oracle.com/otn-pub/java/jdk/7u51-b13/…; – dmourati Mar 15 '14 at 22:25

The problem is that downloaded package does not match the checksum which is in the package:

sha256sum mismatch jdk-7u51-linux-x64.tar.gz

You should switch to a different mirror, run apt-get update and try installing again. If the problem persists, then something is altering your downloaded files.

Debian's download mirrors/repositories for packages are set in /etc/apt/sources.list and you can edit this file with any text editor.

share|improve this answer
    
How to find and switch that mirror? Anyway your argument is invalid as checksum is not good as downloaded file is HTML rather than tar as I stated in my question do itd -1 – Szymon Toda Mar 15 '14 at 17:25
    
Debian's download mirrors/repositories for packages are set in /etc/apt/sources.list and you can edit this file with any text editor. – phoops Mar 15 '14 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .