<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这个工具还是不错的。。。







于是:







查看alternatives的帮助;
















下面先安装jre1.5.0_09,此版本可以到sun的公司网站上下得;





















































接着,使用alternatives工具增加这个版本;




























































查看效果:















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