title: How to pass environment variable to Tomcat running as Windows service
body: <p>I have an application installed in Tomcat that is invoked by the wrapper which sets an environment variable </p>
  
  <pre><code>set FOO=c:\foo
  </code></pre>
  
  <p>and invokes the <code>startup.bat</code>, and I have a requirement to run Tomcat as windows service.</p>
  
  <p>So far, I tried to set the system environment variable, which did not help.
  I tried following the windows service <a href="https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html" rel="nofollow">HOWTO</a> appending <code>++Environment</code> in the registry, so that</p>
  
  <pre><code> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tomcat7\Parameters\ImagePath 
  </code></pre>
  
  <p>looks like this</p>
  
  <pre><code>C:\Apache\Tomcat-7.0.64\bin\Tomcat7.exe //RS//Tomcat7 ++Environment=FOO=c:\foo
  </code></pre>
  
  <p>That did not help either.</p>
  
  <p>Any suggestions, please</p>