Configure JDK environment variables under windows xp:
1. Install JDK. During the installation process, you can customize the installation directory and other information. For example, we choose the installation directory as D:/java/jdk1.5.0_08;
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 3 properties, JAVA_HOME, PATH, CLASSPATH (case does not matter). If it already exists, click "Edit", if it does not exist, click "New";
5. JAVA_HOME indicates the JDK installation path, which is the path D:/java/jdk1.5.0_08 selected during the installation. This path includes lib, bin, jre and other folders (it is best to set this variable because tomcat will be run later. eclipse, etc. need to rely on *this variable);
Path allows the system to identify java commands in any path, set to:
%JAVA_HOME%/bin;%JAVA_HOME%/jre/bin
CLASSPATH is the path for Java to load classes (class or lib). Only when the class is in the classpath can the java command recognize it. Set it to:
.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar (add . to indicate the current path)
%JAVA_HOME% refers to the JAVA_HOME specified previously;
6. "Start" -> "Run", type "cmd";
7. Type the commands "java -version", "java", and "javac". A screen will appear, indicating that the environment variables are configured successfully;
8. Okay, let’s call it a day. Let’s start your first java program.