Path: Specifies the JVM directory in the directory. The objective is to find the javac.exe for compiling the Java source program and the java.exe for executing the *. class file. For example, my jdk installation directory is D:/jdk1.5.0 _ 08 (specifically, my JDK is not an installed version, but is directly decompressed to d, in this case, set the path to: path = D:/jdk1.5.0 _ 08; D:/jdk1.5.0 _ 08/bin. After setting the path, you can enter javac in the command line, and java commands. If the help document of the command can be printed at this time, the path settings are correct. Of course, you can also execute the rmic command in this directory to generate the corresponding stub and skeleton. Classpath: Specifies the directory of the class file (. jar file) We write or use. Here is an example: for example, My classpath is not set at the beginning, and the directory of my java class file is d:/javalesson/lesson1, set the directory of my command line window to d:/javalesson/lesson1 (that is, the directory where my class files are stored. class files can be found. If I set the classpath directory, for example, to classpath = c:/abc, the directory in the command line window is still: d: /javalesson/lesson1 (that is, the directory in which my class files are stored has not changed). When you run java again, the following error occurs, this is because if you set the environment variable classpath, the system will no longer query a class in the current directory, so the system will not find such an error; if you want the system to find a class in the directory specified by classpath and query a class in the current directory, you only need to have one ". ", for example, classpath = c:/abc ;. at this time, even if your directory is in d:/javalesson/lesson1, you will find the class file. The following describes how to set java environment variables in common systems: (1) if it is Win95/98, in/autoexec. add the following three lines at the end of bat: JAVA_HOME = c:/j2sdk1.4.1 PATH = % JAVA_HOME %/bin; % PATH % CLASSPATH = .; % JAVA_HOME %/lib Note: 1) the first ". ", this represents the current directory, many people HelloWorld does not run most of this reason. 2) Considerations for writing batch files: <1> no space is allowed on both sides of the "=" sign, otherwise, many inexplicable errors may occur. <2> you can use % AAA % to obtain the AAA value of the variable. <3> note the following ##, however, many parameters can be added to each command directly following the character <4>. You can use command -- help to check the usage of these parameters. (2) if it is Win2000 or XP, right-click "my computer"-> properties-> advanced-> environment variable system variable-> New-> variable name: JAVA_HOME variable value: c:/j2sdk1.4.1 system variable-> New-> variable name: CLASSPATH variable value :.; % JAVA_HOME %/lib system variable-> edit-> variable name: Path is added at the beginning of the variable value: % JAVA_HOME %/bin; Note ". "It has the same meaning as above. (3) If a Linux User is in your environment, I usually add it to the. bashrc file. You can add it to your Profile file. Suppose/usr/local/jdk installs the jdk directory for you. Export JAVA_HOME =/usr/local/jdk export CLASSPATH =.: $ JAVA_HOME/lib export PATH = $ PATH: $ JAVA_HOME/bin