Download address: http://java.sun.com/products/archive/j2se/1.4.2_06/index.html
Step 1: ----Install J2SDK:
Go to the SUN official site ( http://java.sun .com ) 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 in the variable name: JAVA_HOME
and enter in the variable value: D:Java
(assuming that J2SDK is installed in the directory D:Java, which is the installation directory of J2SDK anyway.)
Then ---OK, the JAVA_HOME environment variable has been set now.
Set the CLASSPATH environment variable:
Click --- New, enter in the variable name: CLASSPATH
and 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 in the variable name: PATH
Enter in the variable value: D:Java;.;D:Javabin
(the middle period "." and semicolon " ;" is essential.)
Then --- confirm, the JAVA_HOME environment variable has been set.
After setting the three environment variables, write a simple java program to test whether J2SDK has been successfully installed:
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 then type the following command
javac Test.java
java Test
at this time, the installation is successful.
If this sentence is not printed out, you need to carefully check your configuration.
If the above J2SDK is successfully installed, continue to install Tomcat:
Step 2: ----Install Tomcat:
Download from the tomcat official site ( http://www.apache.org/dist/jakarta/tomcat-4/ ) 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 in the variable name: CATALINA_HOME,
enter in the variable value: D:Tomcat
and then --- OK, now 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:Java lib;D:Javalibdt.jar;D:Javalibtools.jar;D:Tomcatcommonlibservlet.jar
Then you can start tomcat and access http://localhost in IE :8080 , if you see the welcome page of tomcat, the installation is successful.