Environment:
1. Operating System: Windows 2000
In this example, the software is used:
1. jdk1.2.2
Http://java.sun.com/products/jdk/1.2/
2、jakarta-tomcat-4.1.exe
Http://jakarta.apache.org/builds/tomcat/release/v4.0/
Installation Method:
1. Install JDK
Step 1: Configure and install jdk1.2.2-win.exe. The installation directory is D: jdk1.2.2.
The default installation directory of JRE is D: Program files0000oftjre.
Step 2: Update Environment Variables
Start> Settings> Control Panel> system> advanced> environment variables> System Variables
Variable
Create CLASSPATH: D: jdk1.2.2libools. jar; D: jdk1.2.2libdt. jar
Add: D: jdk1.2.2; D: jdk1.2.2in to PATH.
Ii. install Tomcat
Step 1: Decompress jakarta-tomcat-4.1.exe to the d: omcat 4.1 directory.
Step 2: Go to the D: omcat 4.1in directory, find the setclasspath. bat batch file, and add the following two lines:
Start set TOMCAT_HOME = D: omcat 4.1
Set JAVA_HOME = D: jdk1.2.2
Step 3: Click start tombat to start the tomcat server
At this time, a window named Catalina appears with some initialization information, proving that tomcat runs successfully.
Step 4: Enter http: // localhost: 8080 in the browser
If you can see the Tomcat Version 4.1 page, it indicates that Tomcat is successfully installed. There are some examples of jsp and servlet, so far the jsp environment has been built.
Note: The Window Catalina cannot be closed; otherwise, the tomcat server stops service.
Ps: how to make it support servlet:
Add D: Tomcat 4.1commonlibservlet.jar to CLASSPATH.
Suppose we write a congratulate. java
//--------------------------------------
// Import needful package
Import java. io .*;
Import javax. servlet .*;
Import javax. servlet. http .*;
Public class congratulate extends HttpServlet {
Public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
Response. setContentType ("text/html ");
PrintWriter out = response. getWriter ();
Out. println ("Out. println ("<body> ");
Out. println ("hello! ");
Out. println ("</body>"); out. println ("Out. flush ();
}
}
//----------------------------------------
Javac congratulate. java compiled into congratulate. class
Put the compiled congratulate. class into the web-infclasses directory in the example directory (this directory is not available under my root, creating a new one will not be executed! Please contact my QQ: 78623269 !!)
Start http: // 127.0.0.1: 8080/examples/servlet/congratulate and run it!
Successful!