0

I need to install Java jdk 11 on my lubuntu laptop, but when I write this in the terminal: sudo apt-get install oracle-java11-installer I get this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 google-chrome-stable : Depends: libappindicator3-1 but it is not going to be installed
 oracle-java11-installer : Depends: java-common (>= 0.24) but it is not going to be installed
                           Recommends: gsfonts-x11 but it is not going to be installed
                           Recommends: oracle-java11-set-default but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

and

> Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 google-chrome-stable : Depends: libappindicator3-1 but it is not going to be installed
 openjdk-11-jre-headless : Depends: ca-certificates-java but it is not going to be installed
                           Depends: java-common (>= 0.28) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

for sudo apt install openjdk-11-jre-headless

How do I fix this?

when i tried fix broken install I got this

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

I don't really care if I get open or oracle java, I just need to install jdk.

I have Lubuntu 18.10

when using sudo apt install I get this error:

    Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 google-chrome-stable : Depends: libappindicator3-1 but it is not going to be installed
 oracle-java11-installer : Depends: java-common (>= 0.24) but it is not going to be installed
                           Recommends: gsfonts-x11 but it is not going to be installed
                           Recommends: oracle-java11-set-default but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Thanks

  • Your last two errors show you tried to execute a command as a user, instead of elevating your privileges with sudo. I'd suggest a sudo apt -f install, and providing information such as your release of Lubuntu can be useful. Your error messages show prior ignored errors (google-chrome-stable) that should be fixed first (before you try and add new packages such as the jdk) – guiverc May 1 at 23:08
  • The google-chrome-stable required dep. is available for some releases (packages.ubuntu.com/…) but as you didn't provide your release; you'll have to look yourself. – guiverc May 1 at 23:09
  • I have Lubuntu 18.10 – NikolaJ May 2 at 7:26
  • Did you run sudo apt -f install and if you had errors, what were they? The aforementioned package is available for 18.10 (packages.ubuntu.com/…) so if you apt-cache policy libappindicator3-1 what do you get? You've either corrupted your sources, or are using an out-of-date mirror (launchpad.net/ubuntu/+archivemirrors) but please run the command I suggested in first comment as that's the first thing to fix (plus did you correct the permissions issue I've already answered, ie. you forgot sudo). – guiverc May 2 at 7:38
  • When I used sudo apt install I got an error similar to the ones I posted but it's too long to paste it in a comment so I will edit my question and add it – NikolaJ May 2 at 13:03
0

Try installing java-common and libappindicator3-1 like apt is suggesting.

do:

sudo apt install libappindicator3-1 java-common

That should fix up most of the oracle java errors (for dpkg system).

There is another way to install JAVA on your system, one which does not depend upon your apt system.

You can download the non deb version of Java from Sun and the install instructions are here.

To ensure the correct java is called:

First install the downloaded java as an alternate:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0.05/bin/java 1

This is assuming that you have installed the java (which you just downloaded) into /usr/lib/jvm/jdk1.8.0.05/

You may change this location as per your install.

Next, set this one as default, Do:

 sudo update-alternatives --config java

and choose the version you want as default.

  • Thanks, I'll try doing that. The problem is that I didn't install Java. When I use java -version, it tells me Java isn't installed at all. – NikolaJ May 2 at 13:23
  • When I used the first command you suggested I got this: Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: libappindicator3-1 : Depends: libindicator3-7 (>= 0.4.90) but it is not going to be installed – NikolaJ May 2 at 13:26
  • 1
    FYI, oracle-java*-installer packages from PPAs will no longer work properly. This is because of how Oracle changed their licensing and how to gain access to Java downloads. – Thomas Ward May 2 at 13:44
  • This answer is correct but ignores the problem of broken packages. You need to correct that before installing anything else. Please read the comments from @guiverc above and please provide the information they ask. That's the only way to troubleshoot your software sources. – GabrielaGarcia May 2 at 15:11
  • @NikolaJ rerun the first command with new package also added to the list: sudo apt install libappindicator3-1 java-common libindicator3-7 – Domo N Car May 2 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.