日期:2014-05-16 浏览次数:20723 次
当成功把jdk1.6安装到 /usr/java,并且配置好了系统环境变量?
?
执行 # java -version 时显示的不是你安装的jdk版本,而是其它版本如jdk1.4.2,是因为linux系统有默认的jdk,版本为1.4.2;
?
[root@ip-10-0-0-54 lib]# java -version java version "1.4.2" gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-44) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.?
?
?
切换默认jdk版本执行
1.?
?
# cd /usr/bin # ln -s -f /usr/java/jdk1.6.0_24/jre/bin/java # ln -s -f /usr/java/jdk1.6.0_24/bin/javac?
2. Remove the old empty java environment?
# rm -f /usr/bin/java # rm -f /usr/bin/javac # rm -f /etc/alternatives/java # rm -f /etc/alternatives/javac)?
如果执行完1,查看 /usr/bin下的java properties,如果已经修改过来了,则步骤2不必再执行,命令行输入?
# java –version?
则可以看到jdk版本已经正常
java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)?