Ubuntu – How to remove error message when installing new softwares

command lineinstallationjavasoftware-center

First I had installed oracle java via terminal. its get en error. I don't remember the error message. but other java app are working example netbeans, eclipse. The main problem is when i installed any new softwares via terminal or ubuntu software center, first i get this error.

sha256sum mismatch jdk-7u3-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)

How to remove this message and and reinstall java properly. I'm using Ubuntu 12.04

EDIT
When i trying to remove the Sun Java(TM) Development Kit (JDK) 7 i got this error message.

installArchives() failed: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 189962 files and directories currently installed.)
Removing oracle-java7-installer ...
update-alternatives: error: unknown argument `cdrom'
dpkg: error processing oracle-java7-installer (--remove):
 subprocess installed pre-removal script returned error exit status 2
No apport report written because MaxReports is reached already
Downloading...
--2012-05-21 22:54:41--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-i586.tar.gz
Resolving download.oracle.com (download.oracle.com)... 222.165.168.249, 222.165.168.202
Connecting to download.oracle.com (download.oracle.com)|222.165.168.249|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-i586.tar.gz [following]
--2012-05-21 22:54:42--  https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-i586.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 173.222.122.174
Connecting to edelivery.oracle.com (edelivery.oracle.com)|173.222.122.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2012-05-21 22:54:43--  http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com (download.oracle.com)|222.165.168.249|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5307 (5.2K) [text/html]
Saving to: `./jdk-7u3-linux-i586.tar.gz'

     0K .....                                                 100%  152K=0.03s

2012-05-21 22:54:43 (152 KB/s) - `./jdk-7u3-linux-i586.tar.gz' saved [5307/5307]

Download done.
sha256sum mismatch jdk-7u3-linux-i586.tar.gz
Oracle JDK 7 is NOT installed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java7-installer

Best Answer

Running these commands should fix your problem:

sudo apt-get update
sudo apt-get --purge reinstall oracle-java7-installer
sudo apt-get upgrade

If they do not, then please edit your question to include all the text from the Terminal from when you ran them (as the output would still be diagnostically useful).