我正在尝试在 ubuntu 12.4 上安装 JDK7。
第一次尝试时,当我使用终端下载 JDK7 时,电源断了,笔记本电脑关机了,当时我正在使用下一个终端命令
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
当电源恢复后,我尝试再次安装 JDK7,但锁出现了问题,但我在重新启动机器后使用以下命令修复了它
sudo apt-get install whatever
之后我尝试使用上面的三个命令再次安装,第一个命令没有错误,第二个命令也没有错误,
但第三条命令成功下载了包,但出现了错误
Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-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)
我搜索了此错误的解决方案并找到了一些,尝试了以下说明
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 update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
再次尝试,但出现相同的“Oracle JDK7 未安装”错误。
尝试过sudo apt-get -f install
salahuddin@salahuddin:~$ sudo apt-get -f install
[sudo] password for salahuddin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
thunderbird-globalmenu
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 259 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up oracle-java7-installer (7u51-0~webupd8~1) ...
Downloading Oracle Java 7...
--2014-02-03 16:28:51-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz
Resolving download.oracle.com (download.oracle.com)... 41.128.128.35, 41.128.128.40
Connecting to download.oracle.com (download.oracle.com)|41.128.128.35|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz [following]
--2014-02-03 16:28:51-- https://edelivery.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz
Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.48.230.140
Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.48.230.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz?AuthParam=1391437853_a122991b0aaf032ed8c2812472d1c92c [following]
--2014-02-03 16:28:53-- http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.tar.gz?AuthParam=1391437853_a122991b0aaf032ed8c2812472d1c92c
Connecting to download.oracle.com (download.oracle.com)|41.128.128.35|:80... connected.
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable
The file is already fully retrieved; nothing to do.
Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-7u51-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)
不知道如何修复
请帮忙
提前致谢
答案1
在终端上运行以下命令,
sudo dpkg -P oracle-java7-installer
sudo apt-get -f install
答案2
我有另一种可能的解决方法,但需要手动干预。这之所以失败是因为 Oracle 希望您接受 OTN 许可证。解决方法如下:
转到 Oracle Java7 JDK 下载站点(我在这里)。同意OTN协议,然后找到名为“jdk-7u(whateverupdateislatest)-linux-x64.tar.gz“
sudo mv jdk-7u67-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
sudo apt-get install oracle-java7-installer
答案3
我认为您的下载已损坏。您必须先通过代码删除损坏的包:
sudo apt-get purge oracle-java7-installer
清洁你的公寓:
sudo apt clean
删除并重新导入 ropsitory:
sudo add-apt-repository --remove ppa:webupd8team/java
sudo apt-get update
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
再次安装你的软件包:
sudo apt-get install oracle-java7-installer
好好享受吧兄弟!如果问题没有解决,请尝试使用 VPN。也许你和 Oracle 网站之间有过滤
答案4
检查文件/var/cache/oracle-jdk7-installer/jdk-7u51-linux-*.tar.gz
如果它很小(~5000 字节) - 那么它包含告诉您接受 OTN 许可证的文本。
如果可以,切换到oracle-java8-installer
看http://tiemensfamily.com/TimOnCS/2014/03/15/oracle-adds-license-to-java7-installer-fails