Running Tomcat as a 64-bit Windows Service
June 16, 2007

A few days back, I had a struggle getting Tomcat up and running as a Windows service. I had no problems on my local machine, but I could not get it to run on my web host nor was I receiving any helpful error messages. The most puzzling part was Tomcat would work fine when using the startup.bat script provided, but I wanted this installed as a service so that I didn't have to remain permanently logged in.

After research, it seemed the errors were related to the fact that my web host uses Windows Server 2003 64-bit. However, I was using both the 32-bit JDK as well as a 32-bit version of the Tomcat service. Here are the steps to take if you're trying to run Tomcat as a service in a similar environment:

  • Make sure you have the 64-bit JDK installed. You can find this on the Java web site, be sure to scroll to the bottom of the download page to find the "Windows x64 executable". I am using Java 6, but I am sure other versions will work just as well.
  • Next, you will need to obtain a 64-bit version of the tomcat6.exe binary. It was tricky to find, but there is a post on Apache's Bugzilla containing a pre-compiled file ready for use. From the post, click "tomcat5.exe executable..." and download the file. (Update: The Bugzilla post seems to be down, but I believe an updated exe file can be found in the Tomcat SVN Repository)
  • Even though the file is named tomcat5.exe, it worked like a charm for Tomcat 6 as well. First, navigate to the "bin" directory of your Tomcat install. Backup the file named "tomcat6.exe". Drop the file you downloaded into this directory and be sure to rename the file to "tomcat6.exe".
  • Install the service like you normally would, with a command such as service.bat install

 

That's all there is to it. Boot up the Apache Tomcat service and it should now run in your 64-bit environment.