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;