简体   繁体   English

由于软件包损坏,无法在 Ubuntu 中安装 java

[英]Unable to install java in Ubuntu due to broken packages

I am trying to install java in my ubuntu software.Every time i am trying to install JRE or JDK it says:我正在尝试在我的 ubuntu 软件中安装 java。每次我尝试安装 JRE 或 JDK 时,它都会说:

~The following packages have unmet dependencies: default-jre : Depends: default-jre-headless (= 1:1.6-43ubuntu2) but it is not going to be installed Depends: openjdk-6-jre (>= 6b23~pre11-1ubuntu1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages. ~以下包有未满足的依赖: default-jre : Depends: default-jre-headless (= 1:1.6-43ubuntu2) 但不会安装依赖: openjdk-6-jre (>= 6b23~pre11-1ubuntu1 ~) 但它不会被安装 E: 无法纠正问题,您持有损坏的软件包。

and basically anything i try to do is stopped from some broken packages.I tried some cleaning techniques of apt and stuff but nothing helped also.Thank you in advance.基本上我尝试做的任何事情都是从一些破损的包中停止。我尝试了一些 apt 和东西的清洁技术,但也没有任何帮助。提前谢谢你。

You can try apt-get install -f , which should try to resolve the conflict.您可以尝试apt-get install -f ,它应该尝试解决冲突。

If it does, and there are no more conflicts, then you can try and install apt-get install default-jre如果是这样,并且没有更多冲突,那么您可以尝试安装apt-get install default-jre

This issue is a conflict between the OpenJDK and Oracle's own DEB distributions for Ubuntu, especially if you've used the webupd8 PPA in the past to install it.这个问题是 OpenJDK 和 Oracle 自己的 Ubuntu 的 DEB 发行版之间的冲突,特别是如果您过去使用过 webupd8 PPA 来安装它。 I solved it by forcing the override:我通过强制覆盖解决了它:

sudo apt -o Dpkg::Options::="--force-overwrite" --fix-broken install

You can also force it directly with dpkg by running您也可以通过运行 dpkg 直接强制它

sudo dpkg --configure --force-overwrite -a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM