Installing and Configuring Apache's Tomcat 3.1.1 on Microsoft Windows

 

Before You Start

You must have a JDK installed on your machine. This can be downloaded from Sun Microsystem's Web site, http://java.sun.com/products/jdk/1.2/download-windows.html. After the JDK is installed, you need to configure a system environment variable named PATH to point to the bin directory of your JDK installation. This way, you will be able to use the java and javac commands from any directory. Setting the PATH environment variable in a DOS prompt could appear as follows:

set PATH=c:\jdk1.2.2\bin

If you set the environment variable in a DOS prompt, it is local only to that DOS prompt. You will need to set it each time you open a new DOS prompt. If you want an environment variable to be available for all DOS prompts, set the environment variable through the Control Panel.

 

Installing and Configuring Tomcat

1.    To install Tomcat, download it from the Web by going to http://jakarta.apache.org.

2.    Click on Binaries under Download on the left of the screen. This brings you to http://jakarta.apache.org/site/binindex.html, which is a listing of available versions to download.

3.    Scroll down the page and select the version you want to run under the release builds; this document is describing Tomcat version 3.1.1. Click on Tomcat 3.1.1 under the Release Builds. This brings you to an index of various packages of this release.

4.    For a Windows platform, select jakarta-tomcat-3.1.1.zip.You will be asked if you want to open it or save it to disk. Save it to your hard drive.

5.    After it is done downloading, open the zip file with Winzip (or another program of your choice). Extract the files to the root of your hard drive. All the files contain their appropriate directory structure. Your directory structure should now resemble

%DRIVE%:\jakarta-tomcat

                                \bin

                                \conf

                                \doc

                                \lib 

                                \src

                                \webapps

6.    Now that the Tomcat is installed on the machine, it is time to start the server. You can have the server start in the current DOS prompt or in a new DOS prompt.

To start the server in the current DOS prompt, change directory to the bin directory and run the following command:

%DRIVE%:\jakarta-tomcat\bin>tomcat run

To start the server in a new DOS prompt, change directory to the bin directory and run the following command:

%DRIVE%:\jakarta-tomcat\bin>start tomcat run

 

NOTE: Be careful if you use the tomcat start command or the startup.bat script because it appears there is a bug in their script. Use the tomcat run command instead to start Tomcat.

 

7.    Verify the server started by opening a browser and making the following URL request:

http://localhost:8080

8.    There are two ways to shut down the server. One way is to use Ctrl+C in the DOS prompt where the server is running. Using Ctrl+C is not a graceful way of shutting down the server. To do a graceful shutdown of the server, open a new DOS prompt, change directories to %DRIVE%:\jakarta-tomcat\bin, and run the following command:

%DRIVE%:\jakarta-tomcat\bin>tomcat stop

9.    Now that you have Tomcat configured, create your working environment. Create a myJSPs directory under the webapps directory. Then you can keep track of each hours work in separate folders such as

%DRIVE%:\jakarta-tomcat\webapps\myJSPs\Hour2

To make a request for a JSP named demo.jsp located in the Hour2 directory, use the following URL in a browser:

http://localhost:8080/myJSPs/Hour2/demo.jsp