java Ubuntu 16.04:未安装 Oracle JDK 9

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44076790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 07:55:04  来源:igfitidea点击:

Ubuntu 16.04: Oracle JDK 9 is NOT installed

javaubuntu

提问by Bugz

Every time I try to install something from terminal this message pops up to me. Meanwhile I have my Java installed right:

每次我尝试从终端安装某些东西时,都会弹出这条消息。同时,我正确安装了 Java:

download failed   
Oracle JDK 9 is NOT installed.  
dpkg: error processing package oracle-java9-installer (--configure):
 subprocess installed post-installation script returned error exit status 1  
Errors were encountered while processing:  
 oracle-java9-installer  
E: Sub-process /usr/bin/dpkg returned an error code (1)

Please can someone help me solve this; it's really annoying.

请有人帮我解决这个问题;这真的很烦人。

回答by Uddhav Gautam

sudo apt-get purge oracle-java9-installer

solved my issue. Later I also changed Ubuntu Software center server to "Main Server".

解决了我的问题。后来我也将 Ubuntu 软件中心服务器更改为“主服务器”。

回答by Prabodh M

Actually I hit the issue after resolving the wine installation on my Ubuntu 16.04 LTSbox. The wine issue I resolved using the below link.

实际上,我在解决了我的Ubuntu 16.04 LTS盒子上的 wine 安装后遇到了这个问题。我使用以下链接解决的葡萄酒问题。

https://askubuntu.com/questions/935050/unknown-error-class-keyerror-the-cache-has-no-package-named-wine1-6-i38

https://askubuntu.com/questions/935050/unknown-error-class-keyerror-the-cache-has-no-package-named-wine1-6-i38

So that landed me to this post. But I was not able to install the java from apt packages. It threw me errors. Then I realized it was the issue of having multiple Java instances on my system. I already had Oracle Java 9 installed. I just needed to change the current verions using the command

所以这让我找到了这篇文章。但是我无法从 apt 包安装 java。它给我带来了错误。然后我意识到这是我的系统上有多个 Java 实例的问题。我已经安装了 Oracle Java 9。我只需要使用命令更改当前版本

sudo update-alternatives --config java

So if any body hits the error, you can try setting this.

因此,如果任何主体遇到错误,您可以尝试设置它。

回答by Remus Dominic

I was getting the same error so using this command first i removed Java 9

我遇到了同样的错误,所以首先使用这个命令我删除了 Java 9

sudo apt remove oracle-java9-installer

Then I made Java 8 as default

然后我将 Java 8 设为默认值

sudo apt-get install oracle-java8-set-default

After this if you try to install other software it will work or you can also upgrade Java 8 to Java 9.

在此之后,如果您尝试安装其他软件,它将起作用,或者您也可以将 Java 8 升级到 Java 9。

回答by Yanish Pradhananga

First, add Oracle's PPA, then update your package repository.

首先,添加 Oracle 的 PPA,然后更新您的包存储库。

$sudo add-apt-repository ppa:webupd8team/java
$sudo apt-get update

To install JDK 9, use the following command:

要安装 JDK 9,请使用以下命令:

$sudo apt-get install oracle-java9-installer

回答by Deg

I'm not sure what steps you have tried already to install it but the link below is a fairly well explained description of how to install the JDK on Ubuntu. I've always installed the JDK through the webupd8team's ppa and its worked for me so far :)

我不确定您已经尝试过哪些步骤来安装它,但下面的链接很好地解释了如何在 Ubuntu 上安装 JDK。我一直通过 webupd8team 的 ppa 安装 JDK,到目前为止它对我有用:)

A note about the link, it suggests setting the home variable, this may be necessary for you but I've never had to it manually and it's worked so give it a quick check before setting the home variable yourself.

关于链接的说明,它建议设置 home 变量,这对您来说可能是必要的,但我从来没有手动设置过它并且它有效,所以在自己设置 home 变量之前快速检查一下。

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

回答by Bugz

Solved the problem removing all java versions and purging them and re-installing them again probably, thanks everyone who tried to help.

解决了删除所有 Java 版本并清除它们并可能再次重新安装它们的问题,感谢所有试图提供帮助的人。

回答by SkyWalker

Completely removal criteria:

完全去除标准:

To remove Oracle JDK completely, run the commands below:

要完全删除 Oracle JDK,请运行以下命令:

sudo apt-get remove oracle-java9-installer
sudo apt-get remove --auto-remove oracle-java9-installer
sudo apt-get purge oracle-java9-installer
sudo apt-get purge --auto-remove oracle-java9-installer

Resource Link:

资源链接:

https://www.howtoinstall.co/en/ubuntu/trusty/tomcat7?action=remove

https://www.howtoinstall.co/en/ubuntu/trusty/tomcat7?action=remove

After that, install jdk9 using the following command:

之后,使用以下命令安装 jdk9:

Install JDK9 in Ubuntu:

在 Ubuntu 中安装 JDK9:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer

Make it as default:

将其设为默认值:

sudo apt-get install oracle-java9-set-default

Resource Link:

资源链接:

http://zakirrizvi.blogspot.com/2017/10/install-jdk9-in-ubuntu.html

http://zakirizvi.blogspot.com/2017/10/install-jdk9-in-ubuntu.html