title: Simple and flexible method to run java as a windows service
body: <p>I read SO q&amp;a about launch java as windows service wrappers, but can't find/choose product, suitable for my requirements :</p>
  
  <ol>
  <li><p>Wrapper reads all java launch parameters from config file. In registry must be only commands to run wrapper itself - path to exe and maybe path to config. Always grant admin rights to change app parameters in registry is not comfortable.</p></li>
  <li><p>Working dir and path to application also must be in config. I want to place all wrapper files deep into program, because user not intrested in it.</p></li>
  <li><p>No dependencies(.net, python, etc). I don't want to extend requirements of my program.</p></li>
  <li><p>Free for every windows OS, include win64.</p></li>
  <li><p>Simple and lightweight. Size of my program with all 3rd party jars is 12Mbytes. I don't want to add 20Mbytes wrapper.</p></li>
  <li><p>Automaticaly restart if app process dies.</p></li>
  <li><p>Preferably single exe files for all windows platform.</p></li>
  </ol>
  
  <p>I try and lookinkg throught different wrappers and tired a bit. Best suitable till now is: </p>
  
  <ol>
  <li>jslwin (<a href="http://jslwin.sourceforge.net" rel="noreferrer">http://jslwin.sourceforge.net</a>), but i don't know how mature it is(version 0.99). Also parameter lists in config is a bit complex(need to edit parameters quantity).</li>
  <li>winrun4j (<a href="http://winrun4j.sourceforge.net" rel="noreferrer">http://winrun4j.sourceforge.net</a>), but i don't know how mature it is(version 0.45). Also it needs a special class for working as a service.</li>
  </ol>
  
  <p>Also i try or look throught:</p>
  
  <ol>
  <li>YAJWS (<a href="http://yajsw.sourceforge.net/" rel="noreferrer">http://yajsw.sourceforge.net/</a>) too big (30mb), can't make it work with custom files layout.</li>
  <li>Advanced Installer (<a href="http://www.advancedinstaller.com" rel="noreferrer">http://www.advancedinstaller.com</a>) too big (50mb).</li>
  <li>nssm (<a href="http://nssm.cc/" rel="noreferrer">http://nssm.cc/</a>) store launch parameters in registry(no config)</li>
  <li>winsw (<a href="https://kenai.com/projects/winsw" rel="noreferrer">https://kenai.com/projects/winsw</a>) .net required, stops after process dies</li>
  <li>commons-daemon, procrun (<a href="http://commons.apache.org/proper/commons-daemon/index.html" rel="noreferrer">http://commons.apache.org/proper/commons-daemon/index.html</a>) store launch parameters in registry(no config), can't understand this product, i think it's complex.</li>
  <li>jsmooth (<a href="http://jsmooth.sourceforge.net" rel="noreferrer">http://jsmooth.sourceforge.net</a>) complex and old(last update 2007)</li>
  <li>javaservice (<a href="http://forge.ow2.org/projects/javaservice/" rel="noreferrer">http://forge.ow2.org/projects/javaservice/</a>) old (last update 2006)</li>
  <li>runasservice (<a href="http://runasservice.sourceforge.net/" rel="noreferrer">http://runasservice.sourceforge.net/</a>) requires .net</li>
  <li>windows rktools - sc, instsrv, srvany (<a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B137890&amp;x=16&amp;y=7" rel="noreferrer">http://support.microsoft.com/?scid=kb%3Ben-us%3B137890&amp;x=16&amp;y=7</a>)  - store launch parameters in registry(no config)</li>
  <li>jwrapper (<a href="http://www.jwrapper.com/" rel="noreferrer">http://www.jwrapper.com/</a>) seems not what i need. It packs java program in exe file with JRE. It's not about windows services.</li>
  <li>firedaemon (<a href="http://www.firedaemon.com/" rel="noreferrer">http://www.firedaemon.com/</a>) not free. And maybe it's not what i need.</li>
  <li>launch4j (<a href="http://launch4j.sourceforge.net/" rel="noreferrer">http://launch4j.sourceforge.net/</a>) cool ability "search or download java". Maybe i add something like this to simplify installation, but it is still not about subj.</li>
  <li>Java service wrapper (<a href="http://wrapper.tanukisoftware.com/" rel="noreferrer">http://wrapper.tanukisoftware.com/</a>) not free for win64.</li>
  </ol>
  
  <p>Tell me please which wrappers suits my needs? Or maybe i think wrong about wrappers above and some of them suits my needs to?</p>