During Java Development, the first step is to configure the JDK environment variables. The configuration of the JDK environment variables is as follows:
1. PATH environment variable:
The function is to specify the command search path. Execute the command below the I command line, for example, when javac compiles a Java program, it will go to the path specified by the PATH variable to check whether the corresponding command program can be found. We need to add the bin directory under the JDK installation directory to the existing PATH variable. The bin directory contains frequently used executable files such as javac/Java/javadoc waiting, after setting the PATH variable, You can execute tools such as javac and Java in any directory.
2. classpath environment variables:
The function is to specify the Class search path and use the classes that have already been compiled. The premise is that you can find them, and JVM searches for classes through classpth. We need to set DT. jar and tools. jar in the Lib subdirectory under the JDK installation directory to classpath. Of course, the current directory "." must also be added to this variable.
3. java_home environment variables:
It points to the JDK installation directory. Eclipse, netbeans, tomcat, and other software find and use the installed JDK by searching the java_home variable.
How to configure it? The procedure is as follows:
1. My computer --> properties --> advanced --> environment variables.
2. Configure user variables:
A. Create java_home
C: \ Program Files \ Java \ j2sdk1.5.0 (JDK installation path)
B. Create a path
% Java_home % \ bin; % java_home % \ JRE \ bin
C. Create a classpath
.; % Java_home % \ Lib \ tools. Jar
3. test whether the environment variable configuration is successful:
Start --> Run --> cmd
Keyboard: javac, Java
The corresponding command appears, rather than the error message, indicating that the configuration is successful!