java environment variable configuration under windows

1. Find the configuration location

Right click Computer > Properties > Advanced System Settings > Environment Variables


2. Configure environment variables in system variables

 New JAVA_HOME

Variable name: JAVA_HOME

Note: The variable value is the file location where the java jdk is located.

For example: For example, the jdk installation location is C:\Program Files\Java\jdk1.6.0_43, then the variable value is filled in C:\Program Files\Java\jdk1.6.0_43


3. New CLASSPATH

Variable name: CLASSPATH

Variable value: " .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; "  

Note: Do not drop the .; in the variable value


4. Add content to the Path variable, in two cases

If you add it to the beginning of the path, just copy "   %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;   " and paste it at the beginning of the path .

If added to the end of the path, add "  ; %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin  directly after the path


5. Enter the java, javac, java -version commands respectively in the console,  and the JDK compiler information as shown below appears, including the syntax and parameter options of the modification command.
If the configuration is successful, an interface similar to the following will appear. Not necessarily exactly the same. Otherwise, there is a configuration problem, and you need to review and modify the environment variable configuration.

Enter the java command:

Enter javac:


Enter java -version:


If the above display is similar, the java environment variable configuration is successful.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325605756&siteId=291194637