Tomcat - Windows

tomcat

http://crunchify.com/how-to-start-stop-apache-tomcat-server-via-command-line-setup-as-windows-service/
http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html

What is the purpose of the tomcat6.exe file?

It is an application for running Tomcat 6 as a Windows service.

What is the purposeof the tomcat6w.exe file?

It is the GUI application for monitoring and configuring Tomcat services.

What are the command line options for tomcat6w.exe?

  1. ES Edit service configuration. This is the default operation. It is called if the no option is provided but the executable is renamed to servicenameW.exe
  2. MS Monitor service. Put the icon in the system tray.

How can we launch the GUI application that is used to configure the Tomcat service from the command line?

C:\Tomcat6.0-RxMultiServersEnv\bin\Tomcat6w.exe //ES//Tomcat6RxMultiServerEnv

How can we start the service from the command line?

C:\Tomcat6.0-RxMultiServersEnv\bin\Tomcat6.exe //RS//Tomcat6RxMultiServerEnv

For Tomcat 7, use (if it is configured as a service):

<Tomcat Root>/bin>Tomcat7.exe start

How can we stop the service from the command line?

Use the SS command line option:

C:\Tomcat6.0-RxMultiServersEnv\bin\tomcat6.exe //SS//Tomcat6RxMultiServerEnv

For Tomcat 7, use (if it is configured as a service):

<Tomcat Root>/bin>Tomcat7.exe stop

How can we install Tomcat as a service?

  1. Find the cmd.exe, right click on it, and select "Run As Administrator"
  2. cd c:\tomcat6.0\bin
  3. service.bat install

There is also a way to do this by using the tomcat.exe from the command line. See the below question.

How can we run multiple instances of Tomcat as services on the same machine?

I am not a fan of running multiple instances of Tomcat on the same machine. I rather run single instance of Tomcat on multiple machines, but occassionally, I find myself, for short term purposes, have to run multiple instances of Tomcat on the same machine. The procedure for bringing up additional instance of Tomcat:

  • Copy the existing Tomcat6.0 folder to the new location C:\Tomcat6.0-RxMultiServersEnv
  • Install the new service (see below in this same question)
  • Configure the new service to match each tab of the existing service, and make sure that the path for the new service is appropriate.
  • Change the port number in server.xml
  • See if we can start and stop the new service and that things works as expected.
cp "C:\Program Files\.....\Tomcat 6.0" C:\Tomcat6.0-RxMultiServersEnv
C:\Tomcat6.0-RxMultiServersEnv\bin\tomcat6 
    //IS//Tomcat6.0-RxMultiServersEnv 
    --DisplayName="RxMultiServersEnv Apache Tomcat 6" 
    --Install="C:\Tomcat6.0-RxMultiServersEnv\bin\tomcat6.exe" 
    --Jvm=auto 
    --StartMode=jvm 
    --StopMode=jvm 
    --StartClass=org.apache.catalina.startup.Bootstrap 
    --StartParams=start 
    --StopClass=org.apache.catalina.startup.Bootstrap 
    --StopParams=stop
C:\Tomcat6.0-RxMultiServersEnv\bin\Tomcat6w.exe //ES//Tomcat6RxMultiServerEnv

What are the command line option for tomcat6.exe?

  1. /IS/ - Install service. Used during the initial installation only
  2. /US/ - Update service. Used to change service parameters after installation.
  3. /SS/ - Stop Service. Stops the Tomcat Windows Service, if running.
  4. /RS/ - Run Service. Manually start the Tomcat service from the command line.
  5. /TS/ - Terminal Service. Runs the service as a console application. Tomcat6 runs this command by default if no other parameter is specified. This command can be used in conjunction with other parameters to provide debug functionality for the Tomcat service.
  6. /DS/ - Delete Service - Stops the service if it is running, and then deletes it.

How can we remove Tomcat as a service?

  1. Find the cmd.exe, right click on it, and select "Run As Administrator"
  2. cd c:\tomcat6.0\bin
  3. tomcat6 //DS//Tomcat6

How can we modify the heap space required by Tomcat?

Start -> Programs -> Apache Tomcat -> Tomcat Configuration -> Java (tab).
  1. Navigate to c:\tomcat6.0\bin
  2. Right click on tomcat.exe or tomcat6w.exe and select "Run As Administrator"
  3. Specify 512 for each box
tomcat6 //US//Tomcat6 –-JvmMs=512 –-jvmMx=1024

Alternatively, from the command line:

C:\Tomcat6.0-RxMultiServersEnv\bin\Tomcat6w.exe //ES//Tomcat6RxMultiServerEnv
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License