environment variable setting problem solving for Java, Javac-version inconsistency (Java compilation and inconsistent running environment)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.