Running Apache Tomcat

These instructions assume that you have a functioning installation of the JDK (I'm using 1.6.0_21), and that the java and javac commands are in your path. I've tested briefly on both Windows and Red Hat Enterprise Linux, and the instructions work for me. This is a wiki, so if you have better instructions, feel free to edit.

  1. Go to and find the download page for the latest version. As of this writing, that's version 7, available from
  2. Download the Core zip file — that is, the first download available under the “Core” heading. Don't bother with any of the Windows-specific downloads; the Core works fine.
  3. Extract the contents of the zip file and move them somewhere appropriate, such as c:\Program Files\Tomcat\ or ~/tomcat/.
  4. Edit the file conf/context.xml and change the line which reads:

    so that it reads:

    <Context reloadable="true">
  5. If you're going to be running JESS code, copy the jess.jar file from the lib folder of your JESS installation into the lib folder of your Tomcat installation.
  6. Run the startup script. On Windows, this is bin\startup.bat; on Linux and OS X, this is bin/
  7. On Linux/OS X, the various shell scripts may not be executable; chmod u+x *.sh from the command line will fix that.
  8. Launch a web browser and point it to http://localhost:8080/
  9. Make sure your browser displays the default Tomcat home page.

Adding your project to Tomcat

  1. Create a new folder for your project under the webapps folder of your Tomcat installation.
  2. Inside that folder, create a new folder named WEB-INF.
  3. Inside the WEB-INF folder, create a folder named classes.
  4. Copy the .class files from your project into the classes folder, or copy the .java source files and follow the instructions below to compile them.
  5. Create a file named web.xml inside the WEB-INF folder. Here's a sample:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  6. That web.xml file will work for a program which implements a class named HelloJess, as defined in the source like this:
    public class HelloJess extends HttpServlet {

    You will want to alter your web.xml file accordingly.

  7. Visit http://localhost:8080/yourproect/, where yourproject is the name of the folder you created under webapps. If everything worked, the output of your program will be here.

Compiling your code

You'll need to make sure that the servlet API and JESS classes are in your classpath when compiling. This command works for me, when my shell is in the classes folder under WEB-INF in the project folder under webapps:

javac -classpath ..\..\..\..\lib\jess.jar;..\..\..\..\lib\servlet-api.jar *.java

That's for Windows. For everything else, it would be:

javac -classpath ../../../../lib/jess.jar;../../../../lib/servlet-api.jar *.java

If you get the example code from the textbook web site (accessible from the CSS 482 web site, keep the .class files in the project directory, and are working on Linux or OS X, you can use the following modified Makefile to ease recompilation and reinstallation of your code:

.SUFFIXES:	.java .class


build: HelloJess.class Hello.class

	$(JAVAC) -classpath .:$(JAVA_HOME)/jre/lib/rt.jar:$(CATALINA_HOME)/lib/servlet-api.jar:$(JESS) $<

install: build
	cp *.class $(CATALINA_HOME)/webapps/$(APPNAME)/WEB-INF/classes

	rm -f *~ *.class

You will need to change CATALINA_HOME to be your tomcat installation directory ($(HOME) refers to your home directory). After you edit a .java file, you can recompile and reinstall the new .class file using:

make install

The best way to find something here is to use the search box in the upper right or the site index link below.

Mobile QR Link