![每次安装或删除任何东西时都尝试安装 Java JDK](https://linux22.com/image/822253/%E6%AF%8F%E6%AC%A1%E5%AE%89%E8%A3%85%E6%88%96%E5%88%A0%E9%99%A4%E4%BB%BB%E4%BD%95%E4%B8%9C%E8%A5%BF%E6%97%B6%E9%83%BD%E5%B0%9D%E8%AF%95%E5%AE%89%E8%A3%85%20Java%20JDK.png)
我按照本教程安装了 Java JDK:
http://www.duinsoft.nl/packages.php?t=en
安装正常,但每次我安装或卸载任何东西时,都会收到此消息:
Downloading...
--2012-08-08 22:12:26-- http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving download.oracle.com... 201.48.47.25, 201.48.47.27 Connecting
to download.oracle.com|201.48.47.25|:80... connected. HTTP request
sent, awaiting response... 302 Moved Temporarily Location:
https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
[following]
--2012-08-08 22:12:26-- https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving edelivery.oracle.com... 23.62.50.174 Connecting to
edelivery.oracle.com|23.62.50.174|:443... connected. HTTP request
sent, awaiting response... 302 Moved Temporarily Location:
http://download.oracle.com/errors/download-fail-1505220.html
[following]
--2012-08-08 22:12:27-- http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com|201.48.47.25|:80... connected. HTTP
request sent, awaiting response... 200 OK Length: 5307 (5.2K)
[text/html] Saving to: `./jdk-7u3-linux-x64.tar.gz'
0K ..... 100% 416K=0.01s
2012-08-08 22:12:27 (416 KB/s) - `./jdk-7u3-linux-x64.tar.gz' saved
[5307/5307]
Download done. sha256sum mismatch jdk-7u3-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 firefox
(14.0.1+build1-0ubuntu0.11.10.1) ... Please restart all running
instances of firefox, or you will experience problems. Setting up
firefox-globalmenu (14.0.1+build1-0ubuntu0.11.10.1) ... Errors were
encountered while processing: oracle-java7-installer E: Sub-process
/usr/bin/dpkg returned an error code (1)
我已经检查过我的来源列表并且没有提及这一点。
如何删除此代码以避免每次都尝试安装它?
答案1
问题已解决,运行以下命令:
只是寻找任何 Java 安装程序,我在这个目录中找到它并将其删除
sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
如果您的 sources.list 上有任何 Java 存储库,请运行此操作,但我的情况并非如此。
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update
答案2
Java 安装不正确,因此每次您尝试安装某个程序时,apt 都会尝试修复该程序包。查看那里的输出,它无法下载(每次下载 java 程序包时,它都是损坏的)。您有两个选择。
1)继续尝试,直到最终成功下载软件包。2)卸载 oracle-java7-installer