# SCOM 2012 R2: Tomcat as a Windows Service with APM options

There are many ways start Tomcat.  The documentation covers the basics, which for Windows is to modify the catalina.bat:

:noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%set APM_DIR=\path\to\apm\agent\zip\contentsset APM_OPTS=-Djava.library.path="%APM_DIR%" -javaagent:"%APM_DIR%\apm_facade.jar" -Xbootclasspath/p:"%APM_DIR%\apm_facade.jar" -Xbootclasspath/p:"%APM_DIR%\apm_producers.jar"set JAVA_OPTS=%JAVA_OPTS% %APM_OPTS%rem ----- Execute The Requested Command ---------------------------------------

However, what if there is no said file.  Suppose, it is desirable to run Tomcat as a service (see documentation for Tomcat 5, Tomcat 6, and Tomcat 7).  What does one do then?  Below I will give an example for Tomcat 7 with the supposition that the Java APM agent have been placed in the folder \apm
.\bin\Tomcat7 //US//Tomcat7 ++JvmOptions=-javaagent:"\apm\apm_facade.jar"#-Xbootclasspath/p:"\apm\apm_facade.jar"#-Xbootclasspath/p:"\apm\apm_producers.jar"#-Djava.library.path="\apm"

As per the Tomcat (7) documentation, the arguments should be separated by # characters. Also, “If the command line is prefixed with ++ then it’s value will be appended to the existing option.