title: How to install Tomcat 7 as a Windows service using command line install
body: <p>I need to install Tomcat 7 as a Windows service and to start the service manually.</p>
  
  <p>Referring to <a href="http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html" rel="noreferrer">How to install Tomcat as a Windows service</a>, I believe I would need to specify the following on the command line:</p>
  
  <pre><code>tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" --Install="C:\Tomcat7\bin\tomcat7.exe
  </code></pre>
  
  <p>Do I also need to specify all or some of the following on the command line like in the example? If only some, please specify which ones. If anything in the example is incorrect, please specify.</p>
  
  <pre><code>--Jvm=auto
  --StartMode=jvm
  --StopMode=jvm 
  --StartClass=org.apache.catalina.startup.Bootstrap
  --StartParams=start
  --StopClass=org.apache.catalina.startup.Bootstrap 
  --StopParams=stop
  </code></pre>
  
  <p>What I need for sure is to specify the following because I need to tell Tomcat to use a specific java home and not the java home set by the environment variable JAVA_HOME on the server where this will be installed.</p>
  
  <pre><code>--JavaHome="C:\Program Files\Java\jdk1.7.0_51
  </code></pre>
  
  <p>The reason: the server already has a different version of Tomcat (5.5) and it uses an older version of the JDK (1.5). I must not change JAVA_HOME on the server. I simply need to ensure Tomcat 7 uses JDK 1.7 and I have tried this line:</p>
  
  <pre><code>C:\tomcat7\bin&gt;tomcat7 //IS//Tomcat7 --DisplayName="Apache Tomcat 7" --Install="C:\Tomcat7\bin\tomcat7.exe" --JavaHome="C:\Program Files\Java\jdk1.7.0_51"
  </code></pre>
  
  <p>When I attempt to Start the service, the following error message is displayed:</p>
  
  <pre><code>Windows could not start the Apache Tomcat 7 on Local Computer. For
  more information, review the System Event Log. If this is a
  non-Microsoft service, contact the service vendor, and refer to
  service-specific error code 1.
  </code></pre>
  
  <p>I had a look at the System Event Viewer and it provides the following information:</p>
  
  <pre><code>The Apache Tomcat 7 service terminated with service-specific error Incorrect function..
  </code></pre>
  
  <p>I need to figure out these steps because I then need to provide the support team with the information to install this service on the production server. So any help would be greatly appreciated!</p>