在虚拟机中的 Ubuntu 16.04(64 位)上安装 Java 8 时出现各种错误

在虚拟机中的 Ubuntu 16.04(64 位)上安装 Java 8 时出现各种错误

我正在使用 Oracle VM Virtual Box(版本 5.1.18)来运行 Ubuntu 16.04。我正在使用代理服务器。我已在apt.conf和中配置了代理设置apt.config。在这两个文件中,我的 http 代理都设置了用户名、密码、主机、地址,并且我的网络运行正常。我已经能够安装 openjdk-8 版本。我的jdk 版本

openjdk version "1.8.0_131"    
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)    
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

我正在尝试使用命令安装 Java 8

sudo apt-get install oracle-java8-installer

但这是我得到的错误

Package oracle-java8-installer is not available, but is referred to by another package.    
This may mean that the package is missing, has been obsoleted, or
is only available from another source    
E: Package 'oracle-java8-installer' has no installation candidate

我在某处读到我需要使用命令sudo apt install snapd

但这是它显示的错误

Setting up snapd (2.26.10~14.04) ...    
Failed to execute operation: No such file or directory    
dpkg: error processing package snapd (--configure):    
 subprocess installed post-installation script returned error exit status 1    
dpkg: dependency problems prevent configuration of snap-confine:
 snap-confine depends on snapd (= 2.26.10~14.04); however:
  Package snapd is not configured yet.

dpkg: error processing package snap-confine (--configure):
 dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of ubuntu-core-launcher:    
 ubuntu-core-launcher depends on snap-confine (= 2.26.10~14.04); however:

  Package snap-confine is not configured yet.

dpkg: error processing package ubuntu-core-launcher (--configure):    
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.

No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:

 snapd    
 snap-confine    
 ubuntu-core-launcher

E: Sub-process /usr/bin/dpkg returned an error code (1)

如能得到任何帮助我将非常感激,过去一天我一直试图安装 Java,但失败了。

编辑

使用时也会sudo add-apt-repository ppa:webupd8team/java出现此错误-

Cannot add PPA: 'ppa:~webupd8team/ubuntu/java'.
ERROR: '~webupd8team' user or team does not exist.

我提到过这个链接Oracle-Java8-Installer:没有安装候选项

webupd8team-java.list在此链接中的第一个答案中,没有这样的文件/etc/apt/sources.list.d

而在第二个答案中,此命令sudo apt-get install python-software-properties会产生与以下相同的错误sudo apt install snapd

 Failed to execute operation: No such file or directory
 dpkg: error processing package snapd (--configure):
 subprocess installed post-installation script returned error exit status 1
 dpkg: dependency problems prevent configuration of snap-confine:
 snap-confine depends on snapd (= 2.26.10~14.04); however:
 Package snapd is not configured yet.

dpkg: error processing package snap-confine (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-core-launcher:
ubuntu-core-launcher depends on snap-confine (= 2.26.10~14.04); however:
Package snap-confine is not configured yet.

dpkg: error processing package ubuntu-core-launcher (--configure):
dependency problems - leaving unconfigured
Setting up python-apt (1.1.0~beta1build1) ...
No apport report written because the error message indicates its a followup 
error from a previous failure.
                      No apport report written because the error message 
indicates its a followup error from a previous failure.
Setting up python-pycurl (7.43.0-1ubuntu1) ...
Setting up python-software-properties (0.96.20.7) ...
Errors were encountered while processing:
snapd
snap-confine
ubuntu-core-launcher
E: Sub-process /usr/bin/dpkg returned an error code (1)

相关内容