The java environment variable settings cannot be found or the Main class com. sun. tools. javac. Main cannot be loaded.

Source: Internet
Author: User

After jdk1.7 is installed, the environment variables are set. java and java-version are okay, but javac cannot be used: the main class com. sun. tools. javac. main is obviously a lack of jar. Many people on the Internet say that the configuration is wrong. It's speechless. what is the answer?

Later360 offYes. The cause of this problem is 360:

Configure JDK environment variables in windows:

1. Install JDK. You can customize the installation directory and other information during the installation process. For example, select D: \ java \ jdk as the installation directory;

2. After the installation is complete, right-click "my computer" and click "properties ";

3. Select the "advanced" tab and click "environment variables ";

4. In "system variables", set three attributes: JAVA_HOME, PATH, and CLASSPATH (case-insensitive). if it already exists, click "edit". If it does not exist, click "new ";

5. JAVA_HOME indicates the JDK installation path, that is, the path D: \ java \ jdk selected during the installation. This path contains lib, bin, jre, and other folders (it is best to set this variable, because tomcat and eclipse will be run in the future based on this variable );

Path allows the system to recognize java commands in any Path. Set it to % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin

CLASSPATH is a java loading class (class
Orlib) path. Only the class in classpath can be identified by java commands and set :.; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar (to add. indicates the current path)

6. "Start"->; "run", type "cmd ";

7. type the following commands: "java-version", "java", and "javac". If a screen is displayed, the environment variable is successfully configured;

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.