[root@BlueSkytv2.0]#javaUsage:gij[OPTION]...CLASS[ARGS]...toinvokeCLASS.main,org" />

可替换系统(alternatives system)的应用浅议

系统 1580 0
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/46860.html" frameborder="0" width="468" scrolling="no" height="60"></iframe>

[root@BlueSkytv2. 0 ]#java
Usage:gij[OPTION]...CLASS[ARGS]...
toinvokeCLASS.main,or
gij
- jar[OPTION]...JARFILE[ARGS]...
toexecuteajarfile
Try`gij
-- help ' formoreinformation.

于是:
[root@BlueSkytv2. 0 ]#whichjava
/ usr / bin / java
[root@BlueSkysoftware]#ls
/ usr / bin / java - l
lrwxrwxrwx
1 rootroot 22 01 - 15 21 : 23 / usr / bin / java -> / etc / alternatives / java
[root@BlueSkysoftware]#ll
/ etc / alternatives / java
lrwxrwxrwx
1 rootroot 35 05 - 10 13 : 48 / etc / alternatives / java -> / usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / java
这说明java是受fc下同一软件的版本控制工具alternatives控制的,下面就是用这个工具将系统自带的GNU的java换成Sun的java版本;
查看alternatives的帮助;
[root@BlueSkysoftware]#alternatives -- help
替换选择(alternatives)的版本
1.3 . 30 - 版权(C) 1997 - 2000 RedHat,Inc.
在GNU公共许可的条款下,本软件可以被自由发行。

用法:alternatives
-- install link > name > path > priority >
[
-- initscript service > ]
[
-- slave link > name > path > ] *
alternatives
-- remove name > path >
alternatives
-- auto name >
alternatives
-- config name >
alternatives
-- display name >
alternatives
-- set name > path >

公用选项:
-- verbose -- test -- help -- usage -- version
-- altdir directory > -- admindir directory >
并通过实验得到,install是安装同一软件的不同版本,remove则是移出某个版本,config则是选择当前系统使用那个版本,而display则是显示当前使用的版本,auto则是更改当前的状态为自动判断,也就是可以恢复GNU版本java的一个参数;
下面先安装jre1.5.0_09,此版本可以到sun的公司网站上下得;
[root@BlueSkysoftware]#rpm - ivhjre - 1_5_0_09 - linux - i586.rpm
Preparing...###########################################[
100 % ]
1 :jre###########################################[ 100 % ]
检查是否安装成功:
[root@BlueSkysoftware]# / usr / java / jre1. 5 .0_09 / bin / java
Usage:java[
- options] class [args...]
(toexecutea
class )
orjava[
- options] - jarjarfile[args...]
(toexecuteajarfile)

where optionsinclude:
- d32usea 32 - bitdatamodel if available

- d64usea 64 - bitdatamodel if available
- clienttoselectthe " client " VM
- servertoselectthe " server " VM
- hotspot is asynonym for the " client " VM[deprecated]
The
default VM is client.

- cp class searchpathofdirectoriesandzip / jarfiles >
- classpath class searchpathofdirectoriesandzip / jarfiles >
A:separatedlistofdirectories,JARarchives,
andZIParchivestosearch
for class files.
- D name >= value >
set asystemproperty
- verbose[: class | gc | jni]
enableverboseoutput
- versionprintproductversionandexit
- version: value >
requirethespecifiedversiontorun
- showversionprintproductversionand continue
- jre - restrict - search | - jre - no - restrict - search
include
/ excludeuser private JREs in theversionsearch
-? - helpprint this helpmessage
- Xprinthelponnon - standardoptions
- ea[: packagename > ... | : classname > ]
- enableassertions[: packagename > ... | : classname > ]
enableassertions
- da[: packagename > ... | : classname > ]
- disableassertions[: packagename > ... | : classname > ]
disableassertions
- esa | - enablesystemassertions
enablesystemassertions
- dsa | - disablesystemassertions
disablesystemassertions
- agentlib: libname > [ = options > ]
loadnativeagentlibrary
libname > ,e.g. - agentlib:hprof
seealso,
- agentlib:jdwp = helpand - agentlib:hprof = help
- agentpath: pathname > [ = options > ]
loadnativeagentlibrarybyfullpathname
- javaagent: jarpath > [ = options > ]
loadJavaprogramminglanguageagent,seejava.lang.instrument
出现这些字样,表明jre安装成功了;
接着,使用alternatives工具增加这个版本;
[root@BlueSkysoftware]#alternatives -- install / usr / bin / javajava / usr / java / jre1. 5 .0_09 / bin / java 300
配置:
[root@BlueSkysoftware]#alternatives -- configjava

共有
2 个程序提供“java”。

选择命令
-----------------------------------------------
* 1 / usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / java
2 / usr / java / jre1. 5 .0_09 / bin / java

按Enter来保存当前选择[
+ ],或键入选择号码: 2
[root@BlueSkysoftware]#java
Usage:java[
- options] class [args...]
(toexecutea
class )
orjava[
- options] - jarjarfile[args...]
(toexecuteajarfile)

where optionsinclude:
- d32usea 32 - bitdatamodel if available

- d64usea 64 - bitdatamodel if available
- clienttoselectthe " client " VM
- servertoselectthe " server " VM
- hotspot is asynonym for the " client " VM[deprecated]
The
default VM is client.

- cp class searchpathofdirectoriesandzip / jarfiles >
- classpath class searchpathofdirectoriesandzip / jarfiles >
A:separatedlistofdirectories,JARarchives,
andZIParchivestosearch
for class files.
- D name >= value >
set asystemproperty
- verbose[: class | gc | jni]
enableverboseoutput
- versionprintproductversionandexit
- version: value >
requirethespecifiedversiontorun
- showversionprintproductversionand continue
- jre - restrict - search | - jre - no - restrict - search
include
/ excludeuser private JREs in theversionsearch
-? - helpprint this helpmessage
- Xprinthelponnon - standardoptions
- ea[: packagename > ... | : classname > ]
- enableassertions[: packagename > ... | : classname > ]
enableassertions
- da[: packagename > ... | : classname > ]
- disableassertions[: packagename > ... | : classname > ]
disableassertions
- esa | - enablesystemassertions
enablesystemassertions
- dsa | - disablesystemassertions
disablesystemassertions
- agentlib: libname > [ = options > ]
loadnativeagentlibrary
libname > ,e.g. - agentlib:hprof
seealso,
- agentlib:jdwp = helpand - agentlib:hprof = help
- agentpath: pathname > [ = options > ]
loadnativeagentlibrarybyfullpathname
- javaagent: jarpath > [ = options > ]
loadJavaprogramminglanguageagent,seejava.lang.instrument
如此,成功;
查看效果:
[root@BlueSkysoftware]#alternatives -- displayjava
java
- 状态是手工。
链接目前指向
/ usr / java / jre1. 5 .0_09 / bin / java
/ usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / java - 优先度 1420
从keytool:
/ usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / keytool
从rmiregistry:
/ usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / rmiregistry
从jre_exports:
/ usr / lib / jvm - exports / jre - 1.4 . 2 - gcj
从jre:
/ usr / lib / jvm / jre - 1.4 . 2 - gcj
/ usr / java / jre1. 5 .0_09 / bin / java - 优先度 300
从keytool:(
null )
从rmiregistry:(
null )
从jre_exports:(
null )
从jre:(
null )
当前“最佳”版本是
/ usr / lib / jvm / jre - 1.4 . 2 - gcj / bin / java。
结论,alternaties这个工具还是不错的。。。



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1631959


可替换系统(alternatives system)的应用浅议


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论