Chapter 2.2 Unix Daemon

You can run Tomcat as a daemon using the jscv tool from the commons-daemon project. Tomcat binaries include source tarballs for jsvc and must be compiled. To build jsvc, the following lists the requirements:

  • C ANSI compiler (such as GCC)
  • GNU Autoconf
  • JDK

Follow these steps to install Tomcat in Unix Daemon:

1. Configure the JAVA_HOME environment variable to the base path of the JDK.

You may specify the path of the JDK using –with-java parameter when you call the ./configure script.

Example: ./configure—with-java=/usr/java

2. The commands result in a compiled jsvc binary which you can find in the $CATALINA_HOME/bin folder.

It is assumed that you are using GNU TAR. The CATALINA_HOME is an environment variable which points to the base path of the Tomcat installation.

Ensure that you use the GNU make (gmake) instead of the native BSD make on FreeBSD systems.

3. Download commons-daemon binary from the Jakarta Commons download page.

4. Save jsvc.tar.gz and commons-daemon.jar in the $CATALINA_HOME/bin folder. tomcat1.png

5. Use the following commands to run Tomcat as a daemon: tomcat2.png

Some useful jsvc parameters:

  • user is a useful parameter which causes jsvc to switch to another user after completing the daemon initilization. Using the parameter allows Tomcat to run as a non-privileged user, while at the same time using the privileged ports.
  • jsvc –help returns the full jsvc usage information.
  • debug option can be used to debug issues on running jsvc.

You can use $CATALINA_HOME/bin/jsvc/native/tomcat.sh file as a template to automatically start Tomcat at boot time from /etc/init.d. It is recommended to edit the file and change the classname from BootstrapService Bootstrap.

The Commons-Daemon JAR file must ne on the runtime classpath to run Tomcat. The Commons-Daemon JAR file is located in the Class-Path entry of the bootstrap.jar manifest. Add the Commons-Daemon JAR to the -cp argument when launching jsvc to fix errors such as ClassNotFoundException or NoClassDefFoundError.


  • Currently 3.05/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
  Flag Inappropriate Content 0 comments