为什么不能删除java版本?

为什么不能删除java版本?

删除 openjdk-17-jre 和 jdk :

sudo apt remove  openjdk-17-jre openjdk-17-jdk 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  openjdk-17-jdk-headless
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  openjdk-17-jdk openjdk-17-jre
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 9,250 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 295782 files and directories currently installed.)
Removing openjdk-17-jdk:amd64 (17~19-1) ...
update-alternatives: using /usr/lib/jvm/java-11-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto mode
Removing openjdk-17-jre:amd64 (17~19-1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
debian@debian:~/Downloads$ java -version
openjdk version "17-ea" 2021-09-14
OpenJDK Runtime Environment (build 17-ea+19-Debian-1)
OpenJDK 64-Bit Server VM (build 17-ea+19-Debian-1, mixed mode, sharing)
debian@debian:~/Downloads$ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  openjdk-17-jdk-headless
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
After this operation, 248 MB disk space will be freed.
Do you want to continue? [Y/n] y

重新启动并再次登录。

java -version
openjdk version "17-ea" 2021-09-14
OpenJDK Runtime Environment (build 17-ea+19-Debian-1)
OpenJDK 64-Bit Server VM (build 17-ea+19-Debian-1, mixed mode, sharing)

为什么不能删除java版本?

答案1

您还需要删除openjdk-17-jre-headless

sudo apt purge openjdk-17-jre-headless

由于它没有标记为可自动删除,因此可能还有其他软件包仍然依赖于它;上面的命令会告诉你是否是这种情况。

相关内容