无法在 lubuntu 上安装 Java

无法在 lubuntu 上安装 Java

我需要在我的 lubuntu 笔记本电脑上安装 Java jdk 11,但是当我在终端中写下这个:sudo apt-get install oracle-java11-installer 我得到了这个:

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).

> 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).

对于 sudo apt install openjdk-11-jre-headless

How do I fix 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?

我并不真正关心是否使用 open 或 oracle java,我只需要安装 jdk。

我有 Lubuntu 18.10

当使用 sudo apt install 时出现此错误:

    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).

谢谢

答案1

尝试按照 apt 的建议安装 java-common 和 libappindicator3-1。

做:

sudo apt install libappindicator3-1 java-common

这应该可以修复大多数 oracle java 错误(针对 dpkg 系统)。

还有另一种在您的系统上安装 JAVA 的方法,这种方法不依赖于您的 apt 系统。

您可以从 Sun 下载非 deb 版本的 Java,安装说明如下这里

为了确保调用正确的 java:

首先安装下载的java作为备用:

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

假设您已将 java(刚刚下载)安装到 /usr/lib/jvm/jdk1.8.0.05/

您可以根据您的安装更改此位置。

接下来,将其设置为默认值,执行以下操作:

 sudo update-alternatives --config java

并选择您想要的版本作为默认版本。

相关内容