which java
/usr/bin/java
[root@localhost java]# mv /usr/bin/java /usr/bin/java-1.8.0_111 #修改之前的java版本指向链接java-1.8.0_111
[root@localhost java]# ln -s $JAVA_HOME/bin/java /usr/bin/java
[root@localhost java]# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
[root@localhost java]# javac -version
javac 1.8.0_121