Java 7 installation error

I'm getting this output when i try to install oracle-java7 from webupd8 ppa

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
Setting up gsfonts-x11 (0.22) ...
Errors were encountered while processing:
 oracle-java7-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

I face same problem and get in a solution:

  1. Download the JDK here.
  2. Then go to /var/cache/oracle-jdk7-installer/
  3. In that dir remove jdk-7u51-linux-x64.tar.gz and paste the version downloaded from Oracle website.
  4. Try sudo apt-get install oracle-java7-installer again.. this time should work fine!

This is the key:

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

The file jdk-7u51-linux-x64.tar.gz has been corrupted and fails to validate against the expected hash. Try downloading it again, that might fix your issue.


I download source file from Oracle's website and installed manually from scratch... It is working well now ... The solution I used is here

The instructions given are as follows and should be updated for the current version:

Download Java SE 7 JDK for Linux x86 archive. At the time of writing, the file I'm using is jdk-7u21-linux-i586.tar.gz, but the filename will change as updates are released. Apparently there is no longer a jvm folder, so create one.

sudo mkdir /usr/lib/jvm

Move the archive to the jvm folder

sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm/

Change to the jvm folder and extract the JDK from the archive

cd /usr/lib/jvm

sudo tar zxvf jdk-7u21-linux-i586.tar.gz

Everything will be extracted to a new jdk1.7.0_21 folder and you can delete the archive file now. Make symbolic links to the new java binary.

sudo ln -s -b /usr/lib/jvm/jdk1.7.0_21/jre/bin/java /etc/alternatives/java

sudo ln -s -b /usr/lib/jvm/jdk1.7.0_21/jre/bin/java /usr/bin/java

Double-check the version

java -version