Detailed explanation of java environment variables JAVA_HOME, CLASSPATH, PATH settings

       An environment variable is an object with a specific name that contains information that will be used by one or more applications. For example, the path environment variable, when the system is asked to run a program without telling it the full path where the program is located, the system should search for the program in the path specified in path in addition to the current directory. We need to let jdk compile and run the program by setting environment variables.
       First, open My Computer--Properties--Advanced--Environment Variables:
       New system variables JAVA_HOME and CLASSPATH, the contents are as follows:
       Variable name: JAVA_HOME
       Variable value: C:\Program Files\Java\jdk1.7.0
       Variable name: CLASSPATH
       variable Value: .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
[Note]: The first ".;" tells JDK to search for CLASS in the current directory first when searching for CLASS document. The setting of the CLASSPATH environment variable is more critical, because more than 80% of the inexplicable problems you will have in the future may be caused by the wrong CLASSPATH setting, so be extra careful.
       Then, select the environment variable named "Path" in the "System Variables", double-click the variable, add the absolute path of the bin directory in the JDK installation path to the value of the Path variable, and use a semicolon with a half-width and the existing paths are separated.
       Variable name: Path
       variable value: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;
       The above is the environment configuration of java. Now test whether the configuration of the environment variable is successful or not. Enter "javac" in the DOS command line window, and output the help information means the configuration is correct.

Guess you like

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