The reason is that with the system to see what java is to look at / usr / bin / java and usr / bin / javac two links, java_homw changed, and maybe have to change.
Use and which javac which java can be seen separately
[root@localhost ~]# which java
/usr/bin/java
[root@localhost ~]# which javac
/usr/bin/javac
Briefly about, is to put two files ln -s soft link to the java and javac under our new jdk, the command is as follows:
rm -rf /usr/bin/java
rm -rf /usr/bin/javac
ln -s $JAVA_HOME/bin/javac /usr/bin/javac
ln -s $JAVA_HOME/bin/java /usr/bin/java
Check again, java -version on it
Reprinted from: https://www.cnblogs.com/heyboom/p/10542535.html