Java替代品-更改自动模式


9

我安装了三个JDK,这些都是我从事的某些项目所必需的。

运行时,sudo update-alternatives --config java我得到输出:

There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                     Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java   1074      auto mode
  1            /usr/lib/jvm/java-6-oracle/jre/bin/java   1073      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java   1074      manual mode
  3            /usr/lib/jvm/java-8-oracle/jre/bin/java   1072      manual mode

如何将选项3(JDK 8)设置为在自动模式下选择的选项?

Answers:


8

/usr/lib/jvm/java-8-oracle/jre/bin/java其余优先级设置为较高的优先级,以自动将其启用为默认java二进制文件。

你可以做:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-oracle/jre/bin/java 1100

在这里,我使用了优先级值1100,实际上任何大于该值的值1074都可以。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.