Installing and Running Tomcat

Last updated on 2013-05-22 at 18:14.

Linux and Mac OS X

Coming soon ...

Windows

Note

Ant and Tomcat seem to have problems with spaces in file and directory names. The steps below create simple, space-free file and directory names and have been confirmed to work on a 64-bit Windows 7 system.

Installation

  1. Download the zip file distribution, not the installer, to C:\. As of this writing, it's http://apache.cs.utah.edu/tomcat/tomcat-7/v7.0.40/bin/apache-tomcat-7.0.40-windows-x64.zip for the 64-bit version.
  2. Unzip the file in that location, which will create a C:\apache-tomcat-7.0.40 directory. This will be the value of your CATALINA_HOME envoronment variable.
  3. Copy the directory created above to your clipboard.
  4. In the Windows Control Panel, open the Sytem app.
  5. Click on the Environment variables... button.
  6. Create a new environment variable named CATALINA_HOME with the value C:\apache-tomcat-7.0.40
  7. If you had a command shell open, close it and re-open it.
  8. In your command shell, go to C:\apache-tomcat-7.0.40\bin
  9. Type "startup.bat" and press Enter.
  10. Leave your command shell open.
  11. Open a web browser and type http://localhost:8080/ in the address bar.

At this point you should see the "I have Tomcat running" page. If not, try repeating the steps above.

Web App Development Workflow

Try these steps for the tomcat-todo app we discussed in class. Make changes and play with it to become comfortable with the process.

  1. Create a directory in which to store play projects, such as C:\scratch or C:\cs2340.
  2. In another command shell (not the one you left open above for Tomcat), go to the directory you created in Step 1 above.
  3. Type "git clone https://github.com/csimpkins/tomcat-todo.git" and press Enter. Git will clone the repository into tomcat-todo.
  4. Go to the tomcat-todo working directory (cd tomcat-todo).
  5. Type "ant deploy" and press Enter. After a few lines of output you should see a "BUILD SUCCESSFUL" message.
  6. Go to the command shell you left open for Tomcat.
  7. Type "shutdown.bat" and press Enter.
  8. Type "startup.bat" and press Enter. "Bouncing" the server picks up the new files for the todo app.
  9. Open a browser window and type http://localhost:8080/todo/ in the address bar.

At this point you should see a single hyperlink to show the to-do list. Click it and play with the app. Every time you make a change to the app, repeat steps 5-9 above to see the changes.