OpenJDK-7-JRE 抛出“损坏的软件包”错误(14.04 LTS)

OpenJDK-7-JRE 抛出“损坏的软件包”错误(14.04 LTS)

我有一个需要 Java JRE 的应用程序。我决定继续从存储库安装 JRE。通常,我遇到的唯一问题是下载需要很长时间。然而,这次,我得到了这个...

ben@ben-Aspire-5250:~$ sudo apt-get install default-jre
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 default-jre : Depends: default-jre-headless (= 2:1.7-51) but it is not going to be installed
               Depends: openjdk-7-jre (>= 7~u3-2.1.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

当尝试直接安装 openjdk-7-jre-headless 时,我收到此信息:

ben@ben-Aspire-5250:~$ sudo apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-7-jre-headless : Depends: tzdata-java but it is not going to be installed
                          Depends: libnss3-1d (>= 3.12.9+ckbi-1.82-0ubuntu4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我查看了 Synaptic 并尝试“修复损坏的软件包”,但 Synaptic 找不到任何可做的事情。当我尝试时sudo apt-get -f install,我只得到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

这里可能出了什么问题?

值得注意的是,我将所有实例都更改为us.archive.ubuntu.comarchive.ubuntu.com因为安装时美国服务器不稳定。到目前为止,我还没有遇到任何其他问题。

答案1

Ubuntu 软件中心并搜索包软件属性-通用如果尚未安装,请安装该包。

按下超级键(Windows 键)并输入软件源. 进入出现的应用程序并勾选其中存在的所有包。

完成后,在终端窗口(Ctrl++ )中逐个执行以下命令:AltT

sudo apt-get update && sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get autoclean

然后运行,

sudo apt-get install default-jre安装该包。

答案2

我预感到问题可能是由于我使用了archive.ubuntu.com而不是 而导致的us.archive.ubuntu.com。果然,在恢复旧的 sources.list 文件后,问题就解决了。

谢谢您的帮助!

编辑

事实证明,这不是由于使用了错误的服务器而导致的archive.ubuntu.com,而是由于没有启用更新存储库而导致的。tzdata需要进行更新才能使 JRE 正常工作。

我必须进入“软件和更新”应用程序并在“更新”选项卡上启用更新。之后,我就可以安装 JRE 了。

再次感谢您的帮助。我终于可以解决这个问题了。

相关内容