title: How to run multiple JBoss EAP 6.3 instances as Windows services
body: <p>We are migrating our JBoss EAP 4.3 infrastructure to EAP 6.3 (standalone). 
  We currently run several instances on each machine by having different server folders:</p>
  
  <ul>
  <li>JBOSS_HOME\server\instance_1</li>
  <li>...</li>
  <li>JBOSS_HOME\server\instance_n</li>
  </ul>
  
  <p>and a different set of startup scripts for each instance:</p>
  
  <ul>
  <li>JBOSS_HOME\bin\run_instance_1.bat ; JBOSS_HOME\bin\service_instance_1.bat</li>
  <li>...</li>
  <li>JBOSS_HOME\bin\run_instance_n.bat ; JBOSS_HOME\bin\service_instance_n.bat</li>
  </ul>
  
  <p>This way you can define SERVERNAME and SERVERIP for each instance from service_instance_X.bat.</p>
  
  <p>The problem I'm facing is that I cannot seem to find a similar mechanism on EAP6.3. The closest I got was this command:</p>
  
  <pre><code>JBOSS_HOME\bin\standalone.bat -Djboss.bind.address=%SERVERIP% -Djboss.bind.address.management=%SERVERIP% -Djboss.server.base.dir
  =%JBOSS_HOME%\%INSTANCENAME%
  </code></pre>
  
  <p>which does the job, but that does not help when running it as a service.
  There is one promising option to prunsrv which is ++JvmOptions, where you can pass -D and -X options to JVM at service install time, but even when the install command runs successfully with the added options, it keeps starting up using JBOSS_HOME\standalone as jboss.server.base.dir.</p>
  
  <p>Should I rather have custom service.bat, standalone.bat and standalone.conf.bat scripts? Looks like the best approach, but migrating or patching might become troublesome.</p>
  
  <p>Any ideas would be welcome.</p>
  
  <p>Sebastian</p>