操作系统:openSUSE Leap 42.3
当我安装OracleJDK错误时!
$ sudo rpm -ivh jdk-8u151-linux-x64.rpm
[sudo] root 的密码:
准备中... ################################# [100%]
正在升级/安装...
1:jdk1.8-2000:1.8.0_151-fcs ################################# [100%]
Unpacking JAR files...
tools.jar...
plugin.jar...
javaws.jar...
deploy.jar...
rt.jar...
jsse.jar...
charsets.jar...
localedata.jar...
update-alternatives: error: alternative pack200 can't be slave of java: it is a slave of javac
update-alternatives: error: alternative keytool can't be slave of javac: it is a slave of java
警告:%post(jdk1.8-2000:1.8.0_151-fcs.x86_64) 脚本执行失败,退出状态码为 2
实际上,Java文件已写入硬盘。
$ ls -l /usr/java
总用量 8
lrwxrwxrwx 1 root root 16 12月 9 14:08 default -> /usr/java/latest
drwxr-xr-x 1 root root 284 12月 9 14:08 jdk1.8.0_151
lrwxrwxrwx 1 root root 22 12月 9 14:08 latest -> /usr/java/jdk1.8.0_151
```
但是,Java版本不会切换。
$ java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (IcedTea 3.6.0) (build 1.8.0_151-b12 suse-18.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
我不能使用update-alternatives
来切换Java版本而不做任何其他事情。
$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java
Nothing to configure.
所以,我想知道: