linux java -version显示/usr/bin/java,没有那个文件或目录
解决linux下javac -version和java -version版本显示不一致
[javascript] view plaincopy
[root@localhost usr]# $JAVA_HOME/bin/java -version
bash: /bin/java: 没有那个文件或目录
[root@localhost java]# . /etc/profile
[root@localhost java]# . /etc/profile
[root@localhost java]# $JAVA_HOME/bin/java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
[root@localhost java]# which java //就是这个地方,擦!用的是/usr/bin/下面的java。
/usr/bin/java
[root@localhost java]# mv /usr/bin/java /usr/bin/oldjava
[root@localhost java]# ln -s $JAVA_HOME/bin/java /usr/bin/java
[root@localhost java]#
[root@localhost java]# java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
[root@localhost java]#
[root@localhost java]# javac -version
javac 1.6.0_20