table of contents
close
 Top

table of contents

 1. Executive Summary
 2. Details
More Information

Installing a Preconfigured Version
of Apache Tomcat 6.0.28

Fast Steps for Setting Up Tomcat 6.0
for Servlet and JSP Development


Executive Summary

Following are three easy steps for installing Tomcat in debug/development mode, appropriate for those using Tomcat on their desktop machines for developing and testing servlets and JSP. These steps assume you are using Microsoft Windows, but they can easily be adapted for MacOS, Linux, Solaris, and other Unix environments. For more information on configuration, please see the more detailed Apache Tomcat Tutorial.

  1. Unzip Tomcat. Unzip tomcat-6.0.28-preconfigured.zip into the top level of the C drive. This should result in C:\apache-tomcat-6.0.28\. Tomcat is already set up in the most common development configuration. If you use Tomcat only from within Eclipse (recommended!), this is the only needed step, and you can skip the rest of this Web page.
  2. Set JAVA_HOME. Set this environment variable to point at the top-level of your Java installation directory (e.g., C:\Program Files\Java\jdk1.6.0_20). See this sample autoexec.bat file.
  3. Set CLASSPATH. Set this environment variable to include ".", C:\Servlets+JSP, and the servlet/JSP JAR files. See this sample autoexec.bat file.

For a very quick test, open C:\Servlets+JSP, double click on the shortcut to startup.bat, and open http://localhost/ in your browser. If you see something about Tomcat, the setup was successful. But be sure to do the more complete server tests to verify that you have your development and deployment environment also set up properly.

If you find these free tutorials helpful, we would appreciate it if you would link to us.


Details

  1. Unzip Tomcat. Unzip tomcat-6.0.28-preconfigured.zip into the top level of the C drive. This should result in C:\apache-tomcat-6.0.28\. This version of Tomcat has the following settings already in place:
    • The port is changed from 8080 to 80. This lets you enter URLs of the form http://localhost/... instead of http://localhost:8080/....
      • When you download Tomcat from the Apache site, the port is 8080 in case you already have another server running on port 80.
    • Servlet reloading is enabled. This lets you deploy a modified servlet .class file without restarting the server.
      • When you download Tomcat from the Apache site, servlet reloading is disabled for performance reasons. You might want it disabled on a server used for a deployed application, but you definitely want it enabled during development.
    • The invoker servlet is enabled. This lets you drop a servlet .class file into webapps/appName/WEB-INF/classes/packageName and immediately run it with a URL of the form http://localhost/appName/servlet/packageName.servletName. That is, the invoker servlet saves you from editing web.xml to give a servlet-mapping to your servlet.
      • When you download Tomcat from the Apache site, the invoker servlet is disabled. You definitely want the invoker servlet disabled on a server used for a deployed application, but having it enabled on your development server is very convenient for quick testing.
    • Tomcat monitors struts-config.xml and faces-config.xml. Whenever either of these files changes, Tomcat reloads the Web application. This saves you from restarting the server when you change these files.
      • If you do not use Struts or JSF, this change will not be beneficial to you. But it does not hurt either way.
    • Directory listings are turned on. If you type a URL ending in / and there is no welcome file, Tomcat shows a directory listing.
      • Directory listings were on by default in previous Tomcat versions. They are not required but are during development. They are generally disabled for deployment.
  2. Set JAVA_HOME. Set this environment variable to point at the top-level of your Java installation directory (e.g., C:\Program Files\Java\jdk1.6.0_20.) For details, see the sample autoexec.bat file or this section of the main Tomcat tutorial.
  3. Set CLASSPATH. Set this environment variable to include ".", C:\Servlets+JSP, and the servlet/JSP JAR files. For details, see the sample autoexec.bat file or this section of the main Tomcat tutorial.

For a very quick test, open C:\Servlets+JSP, double click on the shortcut to startup.bat, and open http://localhost/ in your browser. If you see something about Tomcat, the setup was successful. But be sure to do the more complete server tests to verify that you have your development and deployment environment also set up properly.


More Information

Java

JSF (JavaServer Faces)

Servlets & JSP
Ajax, GWT, & JavaScript

Spring, Hibernate, & JPA

Struts