Chapter 9. Building Tomcat from Source

Since Tomcat is an open source project, some people may prefer to build it from source. Beware that building Tomcat is not nearly as simple as downloading the binary releases; in fact, we recommend that you start with the binary release. Get it installed and running, and work on your configuration. Then, when you have a bit of spare time (I know, administrators seldom, if ever, have spare time), start downloading the bits and pieces needed to build Tomcat, and start playing with the source distribution. This way, if the build from source doesn’t work the first few times, you will still have a working binary release.


Most people should not build Tomcat from source. The compiled version is multiplatform, and building it is not easy, even for experienced Java developers.

If you do decide to build Tomcat from source code, here’s the general procedure:

  1. Install a JDK. You must have JDK 1.3.0 or higher. See Appendix A for detailed information about how to do this.

  2. Install Ant. You must install Ant Version 1.5 or higher for Tomcat 4.1, or Ant Version 1.4 or higher for Tomcat 4.0.

  3. Download (or pull from CVS) a copy of the Tomcat source code.

  4. Download and install all support libraries, and configure Tomcat’s build files to use them.

  5. Build Tomcat. First build a runnable Tomcat, and then create a Tomcat distribution.

The following sections of this chapter will show you the rest of this process.


Make sure you have enough free hard drive space before beginning; ...

Get Tomcat: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.