Download address: http://java.sun.com/products/archive/j2se/1.4.2_06/index.html
Step one:----Install J2SDK:
Go to the SUN official website ( http://java.sun.com ) to download the J2SDK installation file: j2sdk-1_4_2_04-windows-i586-p.exe. After downloading, install J2SDK; after installation, set the environment variables: My Computer ---Properties---Advanced---Environment variables;
Select --- System Variables (S):
Set the JAVA_HOME environment variable: Click --- New, enter: JAVA_HOME in the variable name, enter: D:Java in the variable value (assuming that J2SDK is installed in the directory D:Java, which is the installation directory of J2SDK anyway.) Then --- confirm, the JAVA_HOME environment variable has been set.
Set CLASSPATH environment variable:
Click --- New, enter in the variable name: CLASSPATH. Enter in the variable value: D:Javabin;.;D:Javalib;D:Javalibdt.jar;D: Javalibtools.jar (The period "." and semicolon ";" in the middle are essential.) Then --- confirm, the CLASSPATH environment variable has been set.
Set the PATH environment variable:
Click --- New, enter: PATH in the variable name, enter: D:Java;.;D:Javabin (the period "." and semicolon ";" in the middle are mandatory) few.)
Then --- confirm, the JAVA_HOME environment variable has been set.
After setting the three environment variables, write a simple java program to test whether the J2SDK has been installed successfully:
Create a new directory test under D:; then write the following program:
public class Test {
public static void main(String args[]) {
System.out.println("This is a test program.");
}
}
Save the above program as a file named Test.java in the directory D:test.
Then open a command prompt window, cd to your test directory, and type the following command
javacTest.java
java Test
At this time, if you see This is a test program. printed out, it means the installation is successful.
If this sentence is not printed, you need to double-check your configuration.
If the above J2SDK is installed successfully, continue to install Tomcat:
Step 2:----Install Tomcat:
Go to the tomcat official site ( http://www.apache.org/dist/jakarta/tomcat-4/ ) to download tomcat:
jakarta-tomcat-4.1.30.exe, download and install. (For example, install it under D:Tomcat.)
After installation, set the environment variables: My Computer---Properties---Advanced---Environment Variables;
Select --- System Variables (S):
Set the CATALINA_HOME environment variable:
Click --- New, enter: CATALINA_HOME in the variable name, enter: D:Tomcat in the variable value, and then --- OK, the CATALINA_HOME environment variable has been set. Set the CATALINA_BASE environment variable: Click --- New, enter: CATALINA_BASE in the variable name. Enter: D:Tomcat in the variable value, and then --- OK. The CATALINA_BASE environment variable has been set. Then modify the CLASSPATH in the environment variable and append servlet.jar under commonlib in the Tomat installation directory to CLASSPATH.
The modified CLASSPATH is as follows:
CLASSPATH=D:Javabin;.;D:Javalib;D:Javalibdt.jar;D:Javalibtools.jar;D:Tomcatcommonlibservlet .jar
Then you can start tomcat and visit http://localhost:8080 in IE. If you see the welcome page of tomcat, the installation is successful.