![在尝试将 Oracle Java 9 安装为 Java 环境变量时,我遇到了一个问题](https://linux22.com/image/1139026/%E5%9C%A8%E5%B0%9D%E8%AF%95%E5%B0%86%20Oracle%20Java%209%20%E5%AE%89%E8%A3%85%E4%B8%BA%20Java%20%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E6%97%B6%EF%BC%8C%E6%88%91%E9%81%87%E5%88%B0%E4%BA%86%E4%B8%80%E4%B8%AA%E9%97%AE%E9%A2%98.png)
我对 Linux 还很陌生,才使用三天,也是这个论坛的新手,如果我犯了错误,请告诉我。
这是我输入 sudo apt-get install oracle-java9-set-default 后收到的错误
Errors were encountered while processing: /var/cache/apt/archives/oracle-java9-set-default_9b126+9b126arm-1~webupd8~0_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
Full output -
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
cabextract chromium-codecs-ffmpeg-extra gstreamer0.10-ffmpeg
libavcodec-extra libhal1-flash libmspack0 libunshield0 oxideqt-codecs-extra
unshield xplayer-plugins-extra
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
oracle-java9-set-default
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 3'540 B of archives.
After this operation, 16.4 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/webupd8team/java/ubuntu trusty/main amd64 oracle-java9-set-default all 9b126+9b126arm-1~webupd8~0 [3'540 B]
Fetched 3'540 B in 1s (2'061 B/s)
Selecting previously unselected package oracle-java9-set-default.
(Reading database ... 235497 files and directories currently installed.)
Preparing to unpack .../oracle-java9-set-default_9b126+9b126arm-1~webupd8~0_all.deb ...
Unpacking oracle-java9-set-default (9b126+9b126arm-1~webupd8~0) ...
dpkg: error processing archive /var/cache/apt/archives/oracle-java9-set-default_9b126+9b126arm-1~webupd8~0_all.deb (--unpack):
trying to overwrite '/etc/profile.d/jdk.csh', which is also in package oracle-java8-set-default 8u101+8u101arm-1~webupd8~2
Errors were encountered while processing:
/var/cache/apt/archives/oracle-java9-set-default_9b126+9b126arm-1~webupd8~0_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
在再次安装该包之前,尝试运行这些命令。
这将删除那些未使用的包。
sudo apt-get autoremove
这将更新并升级软件包。
sudo apt-get update && sudo apt-get upgrade