Chapter 9. Building Tomcat from Source

Because Tomcat is an open source project, some people may prefer to build it from source code. Beware that building Tomcat is not 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 (we 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 at first, as it well may not, you will still have a working binary release.

Warning

Most people should not build Tomcat from source. The official release binaries from http://tomcat.apache.org are multiplatform, and building Tomcat is not necessarily easy.

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

  1. Install a JDK. Please note that you must build Tomcat with Java 1.5.x, not 1.6.x! This is partially because the minimum Java version to run Tomcat 6.0 is Java 1.5.x. So, Tomcat must be buildable with Java 1.5.x. Even so, it should still be buildable with Java 1.6.x but as of this writing it is not.

  2. Install Apache Ant. You must install Ant version 1.6.0 or higher for Tomcat 6.0. Warning: You cannot build Tomcat with Ant version 1.6.4 due to the following bug: http://issues.apache.org/bugzilla/show_bug.cgi?id=35061.

  3. Download or pull a copy of the Tomcat source code ...

Get Tomcat: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.