我尝试从 安装 Sun JDK sudo add-apt-repository ppa:eugenesan/java
,但失败并显示以下信息:
Downloading...
--2012-05-05 15:50:09-- http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving download.oracle.com (download.oracle.com)... 80.239.230.162
Connecting to download.oracle.com (download.oracle.com)|80.239.230.162|: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-05-05 15:50:09-- https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 2.17.254.174
Connecting to edelivery.oracle.com (edelivery.oracle.com)|2.17.254.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
--2012-05-05 15:50:09-- http://download.oracle.com/errors/download-fail-1505220.html
Connecting to download.oracle.com (download.oracle.com)|80.239.230.162|: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% 20.5M=0s
2012-05-05 15:50:09 (20.5 MB/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 while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
oracle-java7-installer
所以显然它正在尝试获取错误的 URL。我已经手动安装了 Java,但现在该包卡在半安装状态,每次我apt-get install
执行任何操作时,错误都会再次出现。
apt-get install -f
显示“1 个未完全安装或删除。”包并因相同错误而失败。我试过了dpkg -P oracle-java7-installer
,但它也失败了。
如何删除这个半安装的包?
答案1
噢耶。。我终于可以删除了这个帖子以下方式:sudo find /var/lib/dpkg -exec grep -l "oracle-java7-installer" {} \;
显示一堆文件,我exit 0
通过键入添加到第一行sudo gedit /var/lib/dpkg/info/oracle-java7-installer.prerm
,保存文件并关闭 gedit。最后,当我回到命令行后,键入sudo dpkg -P oracle-java7-installer
并成功。
答案2
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 更新
sudo 添加 apt-repository ppa:webupd8team/java
sudo apt-get 更新
sudo apt-get 安装 oracle-java7-installer
答案3
使用“Synaptic 软件包管理器”删除或修复损坏的软件包
要下载并安装“Synaptic Package Manager”,请在终端中输入以下命令 >>
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install synaptic