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

NikolaJ
  • 11
  • 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 01 '19 at 23:08
  • The google-chrome-stable required dep. is available for some releases (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=libappindicator3) but as you didn't provide your release; you'll have to look yourself. – guiverc May 01 '19 at 23:09
  • I have Lubuntu 18.10 – NikolaJ May 02 '19 at 07:26
  • Did you run sudo apt -f install and if you had errors, what were they? The aforementioned package is available for 18.10 (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=libappindicator3-1) 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 (https://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 02 '19 at 07: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 02 '19 at 13:03
  • A quick look at another dependency and https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=java-common which again shows issues with your sources as 0.68 > 0.24, so I return to my last comment with the request to apt-cache policy suggestion (you didn't provide the response, now i'd also like apt-cache policy java-common as 18.10 provides a valid package but your box isn't seeing it. These commands (my comment of 5 hours ago asked) show where your box looks for it, as something is wrong there I suspect (ie. corrupt source, or out-of-date mirror why I gave link before) – guiverc May 02 '19 at 13:17
  • This is what I get when I use the cash policy java common java-common: Installed: (none) Candidate: 0.68ubuntu1 Version table: 0.68ubuntu1 500 500 http://archive.ubuntu.com/ubuntu cosmic/main amd64 Packages – NikolaJ May 02 '19 at 13:24
  • @guiverc when I used apt -cache policy libappindicator 3-1 I got this E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? – NikolaJ May 02 '19 at 16:58
  • Please add addition information (output of commands etc) to your question; it's easier to read etc. The last command failed because your system (or another window) was attempting to update at the same moment you tried the command (temporarily unavailable, another process using it) meaning you have to wait a short while & re-try. One dep. package is in 'universe' (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=gsfonts-x11) so check you have 'universe' repo enabled. (https://help.ubuntu.com/community/Repositories/Ubuntu) – guiverc May 02 '19 at 22:31
  • Thanks for the help. I did manage to solve it using auto clean and following all the usual steps. I have another problem now but I will post that as a new question. – NikolaJ May 03 '19 at 19:43

1 Answers1

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 02 '19 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 02 '19 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 02 '19 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. –  May 02 '19 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 02 '19 at 20:15
  • managed to do it. Had to use auto clean and it worked. Now have another problem that I can't add it to IDEA. It says folder can't contain JDK – NikolaJ May 02 '19 at 20:52