title: Oracle java 7 Installation in Ubuntu E: Sub-process /usr/bin/dpkg returned an error code (1)
body: <p>I can't install oracle java 7 following the steps provided in this link:
  <a href="http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html" rel="nofollow noreferrer">http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html</a></p>
  
  <pre><code>sudo add-apt-repository ppa:webupd8team/java
  sudo apt-get update
  sudo apt-get install oracle-java7-installer
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  Suggested packages:
    visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic
    ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming
  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/18,6 kB of archives.
  After this operation, 193 kB of additional disk space will be used.
  Preconfiguring packages ...
  Selecting previously unselected package oracle-java7-installer.
  (Reading database ... 273801 files and directories currently installed.)
  Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~4_all.deb) ...
  oracle-license-v1-1 license has already been accepted
  Processing triggers for desktop-file-utils ...
  Processing triggers for bamfdaemon ...
  Rebuilding /usr/share/applications/bamf.index...
  Processing triggers for gnome-menus ...
  Processing triggers for shared-mime-info ...
  Setting up oracle-java7-installer (7u51-0~webupd8~4) ...
  Downloading Oracle Java 7...
  --2014-03-20 12:12:52--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
  Resolving download.oracle.com (download.oracle.com)... 131.178.7.201
  Connecting to download.oracle.com (download.oracle.com)|131.178.7.201|: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-20 12:12:52--  https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz
  Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.204.22.140
  Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.204.22.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-x64.tar.gz?AuthParam=1395339292_7fc586697ce74b02fa16cb3ec88d3a9d [following]
  --2014-03-20 12:12:52--  http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz?AuthParam=1395339292_7fc586697ce74b02fa16cb3ec88d3a9d
  Connecting to download.oracle.com (download.oracle.com)|131.178.7.201|: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-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)
  </code></pre>
  
  <p>I have also tried doing what says in <a href="https://help.ubuntu.com/community/Java" rel="nofollow noreferrer">https://help.ubuntu.com/community/Java</a> :</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>sudo add-apt-repository ppa:webupd8team/java
  sudo apt-get update
  sudo apt-get install oracle-java7-installer
  </code></pre>
  
  <p>And still no luck :(
  Could anyone help me?
  I am quite lost at why It isn't working.
  Thanks in advance.</p>
  
  <p>EDIT: Found a solution in the following link: <a href="https://askubuntu.com/questions/414885/oracle-jdk-7-is-not-installed-error">https://askubuntu.com/questions/414885/oracle-jdk-7-is-not-installed-error</a></p>
  
  <p>SOLUTION:</p>
  
  <pre><code>sudo dpkg -P oracle-java7-installer
  sudo apt-get -f install
  sudo apt-get install oracle-java7-installer
  </code></pre>