Run Tomcat as a Windows Service with AlwaysUp

How to Run Tomcat 7 as a Windows Service with AlwaysUp

Ensure that Tomcat starts after a reboot and runs 24/7!

Tomcat is a world class, open source Java Servlet container developed by the Apache Software Foundation.

To set up Tomcat with AlwaysUp:

  1. Download and install AlwaysUp, if necessary.

  2. Download and install the Java runtime environment (JRE), if necessary. Be sure to set the JAVA_HOME environment variable so that Tomcat will be able to find Java when it is run!

  3. Download and install Tomcat 7, if necessary. Please make a note of where you installed it as this will be used in a later step. We have used C:\Tomcat.

  4. Tomcat includes a batch file named startup.bat that will start the server but unfortunately the file will not work properly with AlwaysUp. We must make a copy, change one line, and use the new file in AlwaysUp.

    To make the changes:

    1. Open Windows Explorer to the directory where you installed Tomcat.
    2. Navigate to the bin subdirectory.
    3. Find the startup.bat file, make a copy of it in the same directory and rename it to startup-from-alwaysup.bat.
    4. Open the new file in Notepad.
    5. Change the line:
      call "%EXECUTABLE%" start %CMD_LINE_ARGS%
      to
      call "%EXECUTABLE%" run %CMD_LINE_ARGS%
      (The "run" argument prevents the batch file from starting java in a separate window, which would prevent AlwaysUp from keeping track of it properly. Please see the catalina.bat file for details.)

    Add Application

  5. Start AlwaysUp.

  6. Select Application > Add to open the Add Application window:

    Add Application

  7. On the General tab:

    • In the Application field, enter the full path to the batch file that we created in step 3, startup-from-alwaysup.bat.

    • In the Name field, enter the name that you will call the application in AlwaysUp. We suggest Tomcat but you can specify almost anything you like.

    Tomcat Windows Service: General Tab

  8. By default, Tomcat will show a command window when it is run by AlwaysUp. This can be useful for debugging purposes, but if you wish to avoid seeing it, click over to the Logon tab and check the When a user logs on, don't show the application's windows... box.

    Tomcat Windows Service: Logon Tab

  9. Click over to the Startup tab and check the Ensure that the Windows Networking components have started box. This informs AlwaysUp that Tomcat needs the TCP/IP networking stack to operate.

    Tomcat Windows Service: Startup Tab

  10. Click over to the Extras tab. Check the Use this special command to stop the application box and enter the full path to the shutdown.bat file in the Tomcat bin directory. This will ensure that Tomcat is shut down gracefully when it is stopped by AlwaysUp.

    Tomcat Windows Service: Extras Tab

  11. Click the Save button. In a couple of seconds, an application called Tomcat will show up in the AlwaysUp window. It is not yet running though.

    Tomcat Windows Service: Created

  12. To start Tomcat, choose Application > Start "Tomcat".

    Tomcat Windows Service: Running

  13. That's it! Next time your computer boots, Tomcat will start up immediately, before anyone logs on. We encourage you to edit Tomcat in AlwaysUp and check out the many other settings that may be appropriate for your environment.



Tomcat not working properly as a Windows Service?

  • From AlwaysUp, select Application > Report Activity > Today... to bring up a HTML report detailing the interaction between AlwaysUp and your application. The AlwaysUp Event Log Messages page explains the more obscure messages.
  • Is there another Tomcat service running? Look for a service called "Tomcat" in the Windows Services Control Panel application and disable it if there.
  • Consult the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips
  • Contact us and we will be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.5 New!

8.0 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!