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

本文介绍了如何在Linux Debian上安装Apache Solr,并设置Sun Java作为默认Java运行时环境。通过使用`update-alternatives --config java`命令,可以选择不同的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:

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?

Thanks, Robert

解决方案

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:

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.

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值