java - 如何使用命令 update-alternatives --config java

标签 java debian

我正在 Linux Debian (Squeeze) 上安装 Apache Solr。我被指示安装 sun-java jdk 1st。然后有人告诉我应该使用命令 sudo update-alternatives --config java 来确保特定的 java (sun-java) 是默认运行时。然而,当我运行这个命令时,我得到:

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

  Selection    Path                                      Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
  1            /usr/bin/gij-4.4                           1044      manual mode
  2            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
  3            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode

Press enter to keep the current choice[*], or type selection number:

那么我应该选择哪个数字将 sun-java 作为默认运行时? 另外,自动和手动模式到底是什么意思?如果我在上面选择 3 并运行 update-alternative 命令,我会收到与上面相同的输出,除了 * 现在在 3 前面之外似乎没有任何变化,尽管它仍然是手动模式。

有没有办法确认我所做的是正确的?

最佳答案

如果您在选择选项后输入“java -version”,您会注意到一个很大的变化。因此,如果您运行 update-alternatives --config java 并选择选项 3,您将使用 Sun 实现。
此外,关于 automanual 模式,根据 this page 进行选择应使其脱离 auto 模式说明:

When using the --config option, alternatives will list all of the choices for the link group of which given name is the master link. You will then be prompted for which of the choices to use for the link group. Once you make a change, the link group will no longer be in auto mode. You will need to use the --auto option in order to return to the automatic state.

我相信 auto mode 是在您安装第一个/唯一的 JRE/JDK 时设置的。

关于java - 如何使用命令 update-alternatives --config java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12787757/

相关文章:

c - Directfb 1.6.3 无法设置 Gamma 斜坡 --> 参数无效

linux - 如何在 Ubuntu 的 Debian 包中添加依赖文件?

ubuntu - 包含带源的 deb 包文件

css - Font-Awesome:试图让这个东西与 WordPress 一起工作

linux - 如何在 Debian Stretch 上安装 3.7 版的 puppet?

java - 如何使用异步回调实现MVC?

java - 如何按字段打印类对象的内容?

java - 在 JDialog 上使用滚动条 Swing TextArea

java - 有什么方法可以根据某些条件递归调用 Rythm 模板吗?

java - Servlet 无法从数据库中提取值