Java 更新问题

Java 更新问题

我在更新 Ubuntu 电脑时遇到问题。每次我启动更新命令时,终端都会返回以下内容:

15 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/79,3 MB of archives.
After this operation, 324 MB of additional disk space will be used.
Preconfiguring packages ...
Setting up oracle-java8-installer (8u171-1~webupd8~0) ...
Installing from local file /var/cache/oracle-jdk8-installer/jdk-8u171-linux-x64.
tar.gz
Removing outdated cached downloads...
sha256sum mismatch jdk-8u171-linux-x64.tar.gz
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

我该怎么做才能解决这个问题?

答案1

确保签入/usr/lib/jvm/java-8-oracle/文件夹并删除残留的 Java 文件夹,该文件夹将以您计算机上的最新 Java 文件夹命名。将 替换{current-java-version_folder}为该文件夹的名称,然后运行以下命令:

sudo rm -r /usr/lib/jvm/java-8-oracle/{current-java-version_folder}

然后再次安装Java:

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

相关内容