![由于未满足依赖关系,无法安装 openjdk6](https://linux22.com/image/828111/%E7%94%B1%E4%BA%8E%E6%9C%AA%E6%BB%A1%E8%B6%B3%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%EF%BC%8C%E6%97%A0%E6%B3%95%E5%AE%89%E8%A3%85%20openjdk6.png)
我尝试在 12.04 LTS 上安装 openjdk6,使用以下命令:
sudo apt-get 安装 openjdk-6-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:
openjdk-6-jre : Depends: openjdk-6-jre-headless (>= 6b24~pre1-1ubuntu3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
请帮忙。谢谢!
答案1
建议以下内容
sudo apt-get clean
然后
sudo apt-get update
然后
sudo apt-get install openjdk-6-jre
从手册页中可以看到:“ clean 清除已检索到的软件包文件的本地存储库。它会删除 /var/cache/apt/archives/ 和 /var/cache/apt/archives/partial/ 中的除锁定文件之外的所有内容。”
如果这不能解决您的问题,请发布内容/etc/apt/sources.list
(编辑):您的 sources.list 看起来不错。试试sudo apt-get install -f && apt-get install openjdk-6-jre
。apt-get install 的 -f 标志代表“修复”,即尝试纠正存在损坏依赖关系的系统。此选项与 install/remove 一起使用时,可以省略任何软件包,以允许 APT 推断出可能的解决方案。