在 Ubuntu 14.04LTS 上设置 jdk8 时出错

在 Ubuntu 14.04LTS 上设置 jdk8 时出错

我试图使用 指南。下载 jdk 后,我收到一个错误,要求我手动配置 dpkg。

adeen-s@adeen-s-PC:~$ sudo dpkg --configure -a
Setting up oracle-java8-installer (8u66+8u65arm-1~webupd8~1) ...
Installing from local file /var/cache/oracle-jdk8-installer/jdk-8u66-linux-x64.tar.gz
Removing outdated cached downloads...
mv: cannot move ‘jdk1.8.0_66’ to ‘java-8-oracle/jdk1.8.0_66’: Directory not empty
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of oracle-java8-set-default:
 oracle-java8-set-default depends on oracle-java8-installer; however:
  Package oracle-java8-installer is not configured yet.

dpkg: error processing package oracle-java8-set-default (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 oracle-java8-installer
 oracle-java8-set-default

我该如何解决 ?

更新:按照@AB 的建议再次尝试安装。这是输出 -->

2015-11-25 17:56:08 (50.3 KB/s) - ‘jdk-8u66-linux-x64.tar.gz’ 已保存 [181287376/181287376]

下载完成。正在删除过期的缓存下载...安装:无法统计“javaws-wrapper.sh”:没有此文件或目录 dpkg:错误处理软件包 oracle-java8-installer(--configure):子进程安装后安装脚本返回错误退出状态 1 dpkg:依赖性问题阻止配置 oracle-java8-set-default:oracle-java8-set-default 依赖于 oracle-java8-installer;但是:软件包 oracle-java8-installer 尚未配置。

dpkg:处理软件包 oracle-java8-set-default (--configure) 时出错:依赖性问题 - 未配置处理时遇到错误:oracle-java8-installer oracle-java8-set-default

更新: sudo apt-get purge oracle-java8-installer 后的输出

adeen-s@adeen-s-PC:~$ sudo apt-get purge oracle-java8-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  oracle-java8-installer* oracle-java8-set-default*
0 upgraded, 0 newly installed, 2 to remove and 542 not upgraded.
2 not fully installed or removed.
After this operation, 167 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 165086 files and directories currently installed.)
Removing oracle-java8-set-default (8u66+8u65arm-1~webupd8~1) ...
Purging configuration files for oracle-java8-set-default (8u66+8u65arm-1~webupd8~1) ...
Removing oracle-java8-installer (8u66+8u65arm-1~webupd8~1) ...
Purging configuration files for oracle-java8-installer (8u66+8u65arm-1~webupd8~1) ...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.54ubuntu1) ...

答案1

您已使用两种方法安装 Oracle Java

删除文件夹并再次开始安装:

sudo rm -r /usr/lib/jvm/java-8-oracle/jdk1.8.0_66

sudo apt-get install -f
sudo apt-get purge oracle-java8-installer
sudo apt-get install oracle-java8-installer

在那之后

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

您可以使用 PPA 或使用存档进行安装。但不能同时使用两者。

答案2

我们可以通过恢复到以前的 JDK 版本来恢复文件。这似乎是一个愚蠢的解决方案,但它确实有效。

$ cd /var/cache/apt/archives
$ sudo dpkg -i oracle-java8-installer_8u77+8u77arm-1~webupd8~1_all.deb

相关内容