Running Tomcat 4
Most of what I said about starting and stopping Tomcat 5 applies equally to Tomcat 4. Mainly, there are no launcher or JSVC daemon options in the latter
Tomcat 4 bin files
Figure 3.6 shows the contents of the Tomcat 4 bin directory.
As you can see, it is pretty much like Tomcat 5. There are no launcher files or JSVC jar. Unlike Tomcat 5, the 4 distribution comes with a few scripts to manually run the JSP compiler (Jasper).
Tomcat 4 Run Options
Again, most of what I discussed earlier works with Tomcat 4. You can create your rc file for Unix in the exact same way (changing the paths, of course). For installing Tomcat 4 as a service, however, the syntax is different because Tomcat 4 does not use procrun from Commons Daemon. When you use the Windows Installer, you can have it install Tomcat as a service, and then you are done. But if you want to do it manually, you have to use the script in Listing 3.6.
Figure 3.6 Tomcat 4 bin directory contents.
Listing 3.6 Tomcat 4 Service Install Script
"%CATALINA_HOME%\bin\tomcat.exe " -install "Tomcat5" "%JAVA_HOME%\jre\bin\client\jvm.dll" -Djava.class.path="%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar" -Dcatalina.home="%CATALINA_HOME%" -Xrs -start org.apache.catalina.startup.Bootstrap -params start -stop org.apache.catalina.startup.Bootstrap -params stop -out "%CATALINA_HOME%\logs\stderr.log"
Again, for JDK 1.3.x, the path to jvm.dll will be %JAVA_HOME%\jre\bin\classic\jvm.dll.
When you type this command, you get back the message
The service was successfully installed.
To verify, you can go to Control Panel, Administrative Tools, Services, and you should see the Tomcat service listed as Tomcat4, as defined in the script.
From the Services window, you can now set Tomcat to start automatically when the machine boots. You can also manually start and stop Tomcat from this window or, if you prefer, you can run the service from the command line and start Tomcat with
net start Tomcat4
You can stop Tomcat with
net stop Tomcat4
Finally, if you want to remove the service, just type
"%CATALINA_HOME%\bin\tomcat -uninstall Tomcat4
Depending on how you installed the service, you might have a different name from mine. When I install it manually, I usually call the Tomcat 4 service Tomcat4, but the Windows installer calls it Apache Tomcat.