Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Short answer:</strong> It is NOT possible, at least there is no easy way to do it, just as it was discussed on the page Shashank Kadne pointed out. Other than starting Tomcat via <code>startup.bat</code> script and placing you code (or a call to your BAT file) in the <code>setenv.bat</code> file in the same folder as <code>startup.bat</code>.</p> <hr> <p>If you are trying to run applications like Jenkins, Artifactory and alike on a single Tomcat installation - as discussed on that page - a better way would be to create a Tomcat Server Instance (also known as <code>CATALINA_BASE</code>) for each additional application.</p> <p>This way you can have each application as a Windows Service and control it as a service.</p> <p>Assumptions:</p> <ul> <li><p>You Java is installed at <code>C:\Program Files\Java\jdk-7.0_03</code>.</p></li> <li><p>You Tomcat is installed at <code>C:\Program Files\Apache\Tomcat 7</code>.</p></li> <li><p>You want e.g. Jenkins server to be at <code>C:\Program Files\My Jenkins</code>.</p></li> </ul> <p>Start <code>cmd.exe</code>, and do the following:</p> <pre><code> C:\Users\me&gt; set "JAVA_HOME=C:\Program Files\Java\jdk-7.0_03" C:\Users\me&gt; set "CATALINA_HOME=C:\Program Files\Apache\Tomcat 7" C:\Users\me&gt; set "CATALINA_BASE=C:\Program Files\My Jenkins" C:\Users\me&gt; cd "%CATALINA_BASE%" C:\Program Files\My Jenkins&gt; mkdir "%CATALINA_BASE%\bin" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\conf" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\lib" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\logs" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\temp" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\webapps" C:\...Jenkins&gt; mkdir "%CATALINA_BASE%\work" C:\...Jenkins&gt; copy "%CATALINA_HOME%\conf\*.*" "%CATALINA_BASE%\conf" C:\...Jenkins&gt; copy "%CATALINA_HOME%\bin\*.exe" "%CATALINA_BASE%\bin" C:\...Jenkins&gt; copy "%CATALINA_HOME%\bin\tomcat-juli.jar" "%CATALINA_BASE%\bin" C:\...Jenkins&gt; cd bin C:\...Jenkins&gt; ren tomcat7.exe jenkins.exe C:\...Jenkins&gt; ren tomcat7w.exe jenkinsw.exe </code></pre> <p>The next command should be in a single line</p> <pre><code> C:\...Jenkins&gt; jenkins.exe //IS//Jenkins --DisplayName "Jenkins CI" --Description "Jenkins Continuous Integration Server on Tomcat" --Startup auto --JavaHome "%JAVA_HOME%" --StartMode jvm --StopMode jvm --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop --Classpath "%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;" --StdOutput auto --StdError auto --LogLevel INFO --LogPath "%CATALINA_BASE%\logs" --JvmOptions -Xrs;-Dcatalina.home=%CATALINA_HOME%;-Dcatalina.base=%CATALINA_BASE%; </code></pre> <p>You should now have the <code>Jenkins CI</code> service in your "Services" window.</p> <p>Deploy the Jenkins web application (<code>WAR</code> file) into <code>%CATALINA_BASE%\webapps</code>.</p> <p>The steps I gave above are coming "from the the head" and are not tested, I might have missed a parameter or two. That is why there is the <code>%CATALINA_BASE%\bin\jenkinsw.exe</code> - start it and tweak the parameters until the server is working.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload