10

I'm trying to install JDK7 on ubuntu 12.4.

In the first try, the power has gone and the laptop shutdown in the middle of downloading JDK7 using terminal as I was using the next terminal commands

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

when the power returned and I tried to install JDK7 again there was a problem with the lock but I fixed it using the following commands after restarting the machine

sudo apt-get install whatever

after that I tried installing again using the three commands above, the first was done with no errors and the second too,

but the third command downloaded the package successfully but an error appeared

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-linux-i586.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)

I searched for solutions for this error and found some, tried the following instructions

sudo rm /var/lib/dpkg/info/oracle-java7-installer* 
sudo apt-get purge oracle-java7-installer* 
sudo rm /etc/apt/sources.list.d/*java* 
sudo apt-get update 
sudo add-apt-repository ppa:webupd8team/java 
sudo apt-get update 
sudo apt-get install oracle-java7-installer

tried again but the same "Oracle JDK7 is NOT installed" error appeared.

tried sudo apt-get -f install

salahuddin@salahuddin:~$ sudo apt-get -f install
[sudo] password for salahuddin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  thunderbird-globalmenu
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 259 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up oracle-java7-installer (7u51-0~webupd8~1) ...
Downloading Oracle Java 7...
--2014-02-03 16:28:51--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz
Resolving download.oracle.com (download.oracle.com)... 41.128.128.35, 41.128.128.40
Connecting to download.oracle.com (download.oracle.com)|41.128.128.35|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz [following]
--2014-02-03 16:28:51--  https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.48.230.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.48.230.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz?AuthParam=1391437853_a122991b0aaf032ed8c2812472d1c92c [following]
--2014-02-03 16:28:53--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz?AuthParam=1391437853_a122991b0aaf032ed8c2812472d1c92c
Connecting to download.oracle.com (download.oracle.com)|41.128.128.35|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable

    The file is already fully retrieved; nothing to do.

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-linux-i586.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)

Don't know how to fix it

please help

thanks in advance

1
  • one more thing,post the output of sudo apt-get -f install Feb 3, 2014 at 14:27

4 Answers 4

19

Run the below commands on terminal,

sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
11
  • I was doing another installation while waiting for your answer, now I pressed Ctrl+Z to quit it, and when typed the first instruction you suggest it worked with no errors, the second one was endded with The following package was automatically installed and is no longer required: thunderbird-globalmenu Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 257 not upgraded. 5 not fully installed or removed. E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/cache/apt/archives/
    – Salahuddin
    Feb 3, 2014 at 14:43
  • don't use ctrl+z,use ctrl+c to cancel the installation.Try this command to remove the lock sudo rm /var/cache/apt/archives/lock then run sudo apt-get autoremove Feb 3, 2014 at 14:45
  • I tried Ctrl+C first but doesn't work, but Ctrl+Z worked
    – Salahuddin
    Feb 3, 2014 at 14:49
  • I've removed the lock and tried the two instructions again salahuddin@salahuddin:~$ sudo dpkg -P oracle-java7-installer dpkg: warning: there's no installed package matching oracle-java7-installer salahuddin@salahuddin:~$ sudo apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 257 not upgraded. Is it installed now?
    – Salahuddin
    Feb 3, 2014 at 14:50
  • I think now your problem was solved.Did you run this command sudo dpkg -P oracle-java7-installer two times? Feb 3, 2014 at 14:50
5

I have another potential workaround for this, but it requires manual intervention. The reason this has broken is because Oracle wants you to accept an OTN license. Here is workaround:

Go to Oracle Java7 JDK download site (I found it at Here). Agree to the OTN agreement, then find the file named "jdk-7u(whateverupdateislatest)-linux-x64.tar.gz"

sudo mv jdk-7u67-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/



 sudo apt-get install oracle-java7-installer
1

I think that your download is corrupted . you have to remove the corrupted package first by code :

sudo apt-get purge oracle-java7-installer

Clean your apt :

sudo apt clean

Remove and reimport the ropsitory :

sudo add-apt-repository --remove ppa:webupd8team/java
sudo apt-get update
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update

Install your package again :

sudo apt-get install oracle-java7-installer

Enjoy it bro ! if the problem hasn't solved try using VPN . Maybe there is a filtering between you and the oracle website

0

Check the file /var/cache/oracle-jdk7-installer/jdk-7u51-linux-*.tar.gz

If it is small (~5000 bytes) - then it contains text telling you to accept the OTN license.

If you can, switch to oracle-java8-installer

See http://tiemensfamily.com/TimOnCS/2014/03/15/oracle-adds-license-to-java7-installer-fails

You must log in to answer this question.

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