Problem Description:
JDK1.6 and 1.7 are installed on the computer.
The environment variable java_home is set to the JDK1.6.0_21 installation directory, and%java_home%\bin is added to the path variable, but the execution java-version is displayed under the Windows command line:
Java Version "1.7.0_75"
and the execution javac-version display:
Javac 1.6.0_21
Cause Analysis:
Both 1.6.0_21 and 1.7.0_75 are installed, and in the path variable, the C:\WINDOWS\system32 directory precedes%java_home%\bin.
When you execute a command from the WINDOWS command line, you search for it from the current directory, and then follow the path set to find the command, and the JRE installs the Java.exe to the C:\WINDOWS\system32 directory, so when you execute the java-version command, View the version of the JRE, and the version of the JDK that was viewed when javac-version.
Workaround:
Add%java_home%\bin to the header of the path variable and execute java-version and javac-version, both 1.6.0_21 versions.
environment variable setting problem solving for Java, Javac-version inconsistency (Java compilation and inconsistent running environment)