如何使用命令 update-alternatives --config java [英] How to use the command update-alternatives --config java

查看:95
本文介绍了如何使用命令 update-alternatives --config java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am installing Apache Solr on Linux Debian (Squeeze). I have been instructed to install sun-java jdk 1st. Then am told that I should use the command sudo update-alternatives --config java to make sure that a particular java (sun-java) is the default runtime. Yet when I run this command I get:

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 前面之外似乎没有任何变化,尽管它仍然是手动模式.

So which number should I select to have sun-java as the default runtime? Also, what exactly do th auto and manual modes mean? If I select 3 above and run the update-alternative command I receive the same output as above, again nothing seems to have changed except that the * is now in front of the 3, though it still reads manual mode.

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

Is there a way to confirm that what I have done is correct?

推荐答案

如果你在选择选项后输入java -version",你会注意到一个很大的变化.因此,如果您运行 update-alternatives --config java 并选择选项 3,您将使用 Sun 实现.
此外,关于 automanual 模式,根据 此页面 声明:

You will notice a big change when selecting options if you type in "java -version" after doing so. So if you run update-alternatives --config java and select option 3, you will be using the Sun implementation.
Also, with regards to auto vs manual mode, making a selection should take it out of auto mode per this page stating:

当使用 --config 选项时,替代项将列出所有给定名称为主链接的链接组的选择.你然后将提示您选择哪个选项用于链接团体.进行更改后,链接组将不再位于自动模式.您需要使用 --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 时设置的.

And I believe auto mode is set when you install the first/only JRE/JDK.

这篇关于如何使用命令 update-alternatives --config java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆