Apache Tomcat
Home ] Up ] HTTP ] A Simple Java Web Server ] CGI ] Java Servlets ] [ Apache Tomcat ] Tomcat Directory Structure ] Creating a Web Application ] Web Application Directory Structure ] What's a Servlet? ] Generating Other Content ] The Servlet Life Cycle ] Servlets & Form Data ] Request Headers ] CGI Variables ] Redirection ]

 

 

Tomcat is a free, open-source implementation of Java Servlet and JavaServer Pages technologies developed under the Jakarta project at the Apache Software Foundation. Tomcat is available for commercial use, under the ASF license, from the Apache web site, in both binary and source versions. 

Sun Microsystems adapts and integrates the Tomcat code base into the J2EE Reference Implementation and owns and evolves the JavaServer Pages and Java Servlets specifications, under the Java Community Process.

Downloading and Installing Tomcat

If you want to do anything with servlets -- or JavaServer Pages (JSPs) -- the first thing you need to do is go to the Tomcat web site, and download it.  Tomcat is available at http://tomcat.apache.org/.   Here's what you need to do to install it on your Microsoft Windows machine:

  1. Download and install a Java Development Kit (JDK), if you don't already have one.
    • You'll need to ensure that it is of an appropriate version for the version of Tomcat that you'll be using.  For Tomcat 4.0, you need JDK version 1.2 or later.  
    • You can download the JDK from http://java.sun.com/j2se/
    • Install the JDK according to the instructions included with the JDK release.
    • Set an environment variable JAVA_HOME to the directory into which you install the JDK release.
  2. Find the appropriate download file. 
    I found the Tomcat 4.1.24 link, clicked on it, which resulted in a directory listing. Unfortunately, they don't make it very clear which file you should download.  I chose tomcat-4.1.24.zip, and downloaded it to a directory on my MS WIndows machine.
  3. Unzip the downloaded file into a target directory on your machine.
    I used WinZip, and redirected the unzip target to my C: drive.  The contents of the ZIP file already had a base directory jakarta-tomcat-4.1.24, so I thereby caused a C:\jakarta-tomcat-4.1.24 directory to be created.  That will be your Tomcat install directory.

Starting Tomcat

  1. Bring up an MS-DOS command (or console) window, and:
    • Navigate to the bin directory below the Tomcat home directory:
    cd \jakarta-tomcat-4.1.24\bin
    • Be sure that your JAVA_HOME environment variable is set to the directory where your JDK is installed.
    • Run Tomcat using the command:
      startup

      which will output some information in the command window, and then cause another command window to be launched, which will show a number of messages about Tomcat starting up.

  2. Once Tomcat has started up, you can use your browser to connect to it at:
    http://localhost:8080/

    (the port might vary from one installation to another)

    The resulting page should look something like:

Stopping Tomcat

  1. In a console window (probably the one from which you started Tomcat), type the following command:
    shutdown

    This will cause Tomcat to shut down, and the Tomcat window to go away.

 
The page was last updated February 19, 2008