1. Reason:
When installing jdk, the java.exe, javaw.exe, javaws.exe files generated by jdk on the C drive are configured, and the priority of these environment variables on the C drive is higher than the priority of the environment variables set by JAVA_HOME, so execute java -version , the system will read the jdk that is not configured by JAVA_HOME;
2. The default generation directory of java.exe, javaw.exe, javaws.exe files:
a), jdk1.6, jdk1.7 will generate these three files in: C:\Windows\System32 directory;
b), jdk1.8 will generate these three files in: C:\ProgramData\Oracle\Java\javapath directory;
3. Delete:
Delete these three files in these directories, and execute java -version to read the jdk configured in JAVA_HOME
C:\Users\Administrator>java -version
java version "1.6.0_43"