In Windows, Java mainly uses three environment variables: java_home, classpath, and path. The following analysis is performed one by one.
Java_home points to the JDK installation path, such as X: \ jdk_1.4.2. In this path, you should be able to find the bin, Lib, and other directories. It is worth mentioning that you can select any disk directory for the JDK installation path, but we recommend that you have a lower directory level. If you have a deep directory, such as X: \ xxxxxx \ XXXXX \ XXXX \ XXX ......
Then, you will be tired of the following steps and future applications. Setting method:
Java_home = x: \ jdk_1.4.2
The path environment variable exists in Windows. You only need to modify it to point it to the JDK bin directory, so that you can compile and execute it in the console.ProgramYou do not need to enter a large string of paths. The setting method is to keep the original path content and add % java_home % \ bin to it (Note: if you do not know about DOS batch processing, you may not understand the meaning of the content caused by %. In fact, the environment variable java_home set in the previous step is referenced here. You can write it as X: \ jdk_1.4.2; you can open a console window and enter echo % java_home % to check your settings ):
Path = % java_home % \ bin; % PATH %
Similarly, % PATH % references the previously set path environment variable. You just copy the previous value.
I put the classpath environment variables at the end, because you may encounter inexplicable and strange problems later. More than 80% may be caused by incorrect classpath settings, so be careful.
Classpath =.; % java_home % \ Lib \ tools. Jar
The first thing to note is the front "..;". If you cannot see it clearly, I will read it for you-a semicolon. This tells JDK to first find the class file in the current directory when searching for the Class-why? This is caused by the Linux security mechanism. Linux users understand it very well, windows users are hard to understand (because the default search order in Windows is to search the current directory first, then the system directory, and then the PATH environment variable ), so if you like Linux, you may want to study Linux.
Why is the specific file tools. Jar specified after classpath? Not specified? Obviously, no. I can do that again! :) This is determined by the import mechanism and jar mechanism of the Java language. You can check the information to solve this problem.
The specific setting method is as follows: Right-click Win2k \ XP and choose "my computer"> "properties"> "advanced"> "environment variable". Modify the value in the system variable box below.
The Win9x user modifies the autoexec. BAT file and adds it to the end:
Set java_home = x: \ jdk_1.4.2
Set Path = % java_home % \ bin; % PATH %
Set classpath =.; % java_home % \ Lib \ tools. Jar
You can.
Myeclipse and tomcat do not need to be configured. perform the following operations on your own.