0

I uninstalled java following this tutorial and then I tried to install it again. I typed:

sudo apt-get update

all good and then I run this sudo apt-get install default-jdk and I get :

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.

How can I resolve this please?

I have tried

sudo apt-get clean
sudo apt-get autoclean
sudo apt-get -f install

which prints

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

then:

sudo dpkg --configure -a
sudo apt-get -f install

which prints

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I have also tried:

sudo apt-get install -f default-jre openjdk-6-jdk  # I also get the same error without the -f option

which prints:

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.
yaylitzis
  • 731

1 Answers1

0

I tried to install sudo apt-get install openjdk-6-jre and then I got that some other package was missing. Then I tried to install that package and then I got some other package was missing.

After 3 times, I installed the last package successfully and I started installing all the missing packages from the end, and then I finally installed it!

yaylitzis
  • 731
  • 3
    Could you be more specific? – Zanna Sep 09 '16 at 14:44
  • Having following this question, I think what he meant was that he installed the unmet dependencies and then got another error message about other unmet dependencies which he also installed and repeated the process three times until he got java installed. – karel Sep 10 '16 at 12:02
  • As @karel wrote. – yaylitzis Sep 13 '16 at 08:14