![卸载 Java 后,重新安装 Java 软件包会出现未满足依赖关系的错误](https://linux22.com/image/886301/%E5%8D%B8%E8%BD%BD%20Java%20%E5%90%8E%EF%BC%8C%E9%87%8D%E6%96%B0%E5%AE%89%E8%A3%85%20Java%20%E8%BD%AF%E4%BB%B6%E5%8C%85%E4%BC%9A%E5%87%BA%E7%8E%B0%E6%9C%AA%E6%BB%A1%E8%B6%B3%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB%E7%9A%84%E9%94%99%E8%AF%AF.png)
我按照这个卸载了java教程然后我尝试再次安装它。我输入:
sudo apt-get update
一切都很好然后我运行它sudo apt-get install default-jdk
并得到:
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-jdk : Depends: default-jre (= 1:1.6-43ubuntu2)
Depends: openjdk-6-jdk (>= 6b23~pre11-1ubuntu1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
请问我该如何解决这个问题?
我努力了
sudo apt-get clean
sudo apt-get autoclean
sudo apt-get -f install
打印
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
然后:
sudo dpkg --configure -a
sudo apt-get -f install
打印
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我也尝试过:
sudo apt-get install -f default-jre openjdk-6-jdk # I also get the same error without the -f option
打印结果为:
The following packages have unmet dependencies:
default-jre : Depends: openjdk-6-jre (>= 6b23~pre11-1ubuntu1~)
openjdk-6-jdk : Depends: openjdk-6-jre (= 6b39-1.13.11-0ubuntu0.12.04.1)
Recommends: libxt-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
答案1
我尝试安装sudo apt-get install openjdk-6-jre
,然后发现缺少其他一些软件包。然后我尝试安装该软件包,然后发现缺少其他一些软件包。
经过3次之后,我成功安装了最后一个包并从最后开始安装所有缺少的包,然后终于安装成功了!