When we need to use Java for program development, we must first install jdk, and then configure the Java environment variables according to the jdk installation directory. So how to configure the Java environment variables?
How to configure java environment variables
For Java program development, two commands of the JDK are mainly used: javac. exe,java.exe. Assuming path: C:\Java\jdk 1.7.0 _09\bin. However, since these commands are not Windows' own commands, if you want to use them, you need to configure the path. (Recommended tutorial: java tutorial)
Click "Computer-Properties-Advanced System Settings" and click "Environment Variables". Click "New" under the "System Variables" column to create a new system environment variable.
(1) Create new->Variable name "JAVA_HOME", variable value "C:\Java\jdk1.8.0_05" (that is, the installation path of JDK)
(2)Edit->Variable name "Path", add ";%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin" at the end of the original variable value
(3) New -> Variable name "CLASSPATH", variable value ".;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar"
Confirm environment configuration Is it true:
javac command:
cmd-->java -version
Detect JAVA version
The above is the detailed content of How to configure java environment variables. For more information, please follow other related articles on the PHP Chinese website!