我想在CentOS上升级Java版本(以前是1.8.0_144,现在是1.8.0.201)。 我使用了以下命令:
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_201/jre/bin/java 180201
现在我明白了:
[root@centos java]# alternatives --display java
java - status is auto.
link currently points to /usr/java/jdk1.8.0_201/jre/bin/java
/usr/java/jdk1.8.0_144/jre/bin/java - priority 180144
slave ControlPanel: /usr/java/jdk1.8.0_144/jre/bin/ControlPanel
slave javaws: /usr/java/jdk1.8.0_144/jre/bin/javaws
slave jcontrol: /usr/java/jdk1.8.0_144/jre/bin/jcontrol
slave jjs: /usr/java/jdk1.8.0_144/jre/bin/jjs
slave keytool: /usr/java/jdk1.8.0_144/jre/bin/keytool
slave orbd: /usr/java/jdk1.8.0_144/jre/bin/orbd
slave pack200: /usr/java/jdk1.8.0_144/jre/bin/pack200
slave policytool: /usr/java/jdk1.8.0_144/jre/bin/policytool
slave rmid: /usr/java/jdk1.8.0_144/jre/bin/rmid
slave rmiregistry: /usr/java/jdk1.8.0_144/jre/bin/rmiregistry
slave servertool: /usr/java/jdk1.8.0_144/jre/bin/servertool
slave tnameserv: /usr/java/jdk1.8.0_144/jre/bin/tnameserv
slave unpack200: /usr/java/jdk1.8.0_144/jre/bin/unpack200
slave java.1: /usr/java/jdk1.8.0_144/man/man1/java.1
slave javaws.1: /usr/java/jdk1.8.0_144/man/man1/javaws.1
slave jjs.1: /usr/java/jdk1.8.0_144/man/man1/jjs.1
slave keytool.1: /usr/java/jdk1.8.0_144/man/man1/keytool.1
slave orbd.1: /usr/java/jdk1.8.0_144/man/man1/orbd.1
slave pack200.1: /usr/java/jdk1.8.0_144/man/man1/pack200.1
slave policytool.1: /usr/java/jdk1.8.0_144/man/man1/policytool.1
slave rmid.1: /usr/java/jdk1.8.0_144/man/man1/rmid.1
slave rmiregistry.1: /usr/java/jdk1.8.0_144/man/man1/rmiregistry.1
slave servertool.1: /usr/java/jdk1.8.0_144/man/man1/servertool.1
slave tnameserv.1: /usr/java/jdk1.8.0_144/man/man1/tnameserv.1
slave unpack200.1: /usr/java/jdk1.8.0_144/man/man1/unpack200.1
/usr/java/jdk1.8.0_201/jre/bin/java - priority 180201
slave ControlPanel: (null)
slave javaws: (null)
slave jcontrol: (null)
slave jjs: (null)
slave keytool: (null)
slave orbd: (null)
slave pack200: (null)
slave policytool: (null)
slave rmid: (null)
slave rmiregistry: (null)
slave servertool: (null)
slave tnameserv: (null)
slave unpack200: (null)
slave java.1: (null)
slave javaws.1: (null)
slave jjs.1: (null)
slave keytool.1: (null)
slave orbd.1: (null)
slave pack200.1: (null)
slave policytool.1: (null)
slave rmid.1: (null)
slave rmiregistry.1: (null)
slave servertool.1: (null)
slave tnameserv.1: (null)
slave unpack200.1: (null)
Current `best' version is /usr/java/jdk1.8.0_201/jre/bin/java.
/ etc / alternatives文件夹中的许多从链接仍然指向旧的Java版本,例如
lrwxrwxrwx 1 root root 38 Mar 17 14:12 keytool -> /usr/java/jdk1.8.0_144/jre/bin/keytool
那些从属链接不会自动更改吗?
答案 0 :(得分:1)
以下命令将允许您设置要在CentOS中使用的默认Java版本:
$ sudo alternatives --config java
如果成功,您应该看到1.8.0_201
作为新的默认版本:
$ java -version