“未安装Oracle JDK 7”错误?


9

我正在尝试在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)

不知道如何解决

请帮忙

提前致谢


还有一件事,发布输出sudo apt-get -f install
Avinash Raj 2014年

Answers:


18

在终端上运行以下命令,

sudo dpkg -P oracle-java7-installer
sudo apt-get -f install

我在等待答案的同时进行了另一次安装,现在我按Ctrl + Z退出了,输入第一条说明您建议它没有错误的指令时,第二条以结尾。以下软件包是自动安装的,没有所需时间更长:thunderbird-globalmenu使用“ apt-get autoremove”将其删除。0已升级,0新安装,0已删除和257未升级。5没有完全安装或卸下。E:无法获得锁/ var / cache / apt / archives / lock-打开(11:资源暂时不可用)E:无法锁定目录/ var / cache / apt / archives /
Salahuddin

不要使用ctrl + z,请使用ctrl + c取消安装。尝试使用此命令删除锁定,sudo rm /var/cache/apt/archives/lock然后运行sudo apt-get autoremove
Avinash Raj 2014年

我先尝试了Ctrl + C,但没有用,但是Ctrl + Z起作用了
Salahuddin 2014年

我已解除锁定,并再次尝试了两条指令salahuddin @ salahuddin:〜$ sudo dpkg -P oracle-java7-installer dpkg:警告:没有与oracle-java7-installer salahuddin @ salahuddin匹配的已安装软件包:〜$ sudo apt- get -f install读取软件包列表...完成构建依赖关系树读取状态信息...完成0升级,0新安装,0删除和257未升级。现在安装了吗?
Salahuddin 2014年

我认为现在您的问题已解决。您是否sudo dpkg -P oracle-java7-installer两次运行了此命令?
Avinash Raj 2014年

5

我对此有另一种可能的解决方法,但是它需要手动干预。损坏的原因是因为Oracle希望您接受OTN许可证。解决方法如下:

转到Oracle Java7 JDK下载站点(我在here找到了它)。同意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

1

我认为您的下载已损坏。您必须先通过代码删除损坏的软件包:

sudo apt-get purge oracle-java7-installer

清洁您的公寓:

sudo apt clean

删除并重新导入花言巧语:

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网站之间可能存在过滤


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.