Unable to install java 8 on Ubuntu 14.04 32 bit

I used the following code to install openjdk 7 and to add repository,

sudo apt-get install openjdk-7-jdk
sudo apt-add-repository ppa:webupd8team/java

Then I have updated the packages using sudo apt-get update, After this when I try to install Java using the following command,

sudo apt-get install oracle-java8-installer

I am getting error, the error code response is,

2016-04-20 13:00:45 (442 MB/s) - ‘jdk-8u77-linux-i586.tar.gz’ saved [5165]
Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u77-linux-i586.tar.gz
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

How to debug and resolve this, I am new to Ubuntu. Thanks.


Solution 1:

it seems that your download is corrupted.

[..] sha256sum mismatch jdk-8u77-linux-i586.tar.gz [..]

Try to remove the package

sudo apt-get purge oracle-java8-installer
sudo apt-get clean
sudo apt-get update

then remove the repo and reimport it

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

and reinstall the package

sudo apt-get update
sudo apt-get install oracle-java8-installer

update: if you want to install java you can use this code instead of the last line :

sudo apt install default-jdk