Programming Tips - How can I run Jetty8 as a Windows service?

Date: 2013apr17 OS: Windows Product: Jetty Q. How can I run Jetty8 as a Windows service? A. Install jetty8 in c:\jetty\jetty8 (This doesn't work in c:\Program Files\...) Download Apache prunsrv.exe from http://commons.apache.org/proper/commons-daemon/binaries.html and place it in c:\jetty\jetty8 Create a file called install_jetty_service.bat in that folder containing:
prunsrv install JettyService --DisplayName="Jetty8 Service" --JavaHome="C:\Program Files\Java\jre7" --Startup=auto ++JvmOptions=-Djetty.home=C:\jetty\jetty8 ++JvmOptions=-Djetty.logs=C:\jetty\jetty8\logs\ ++JvmOptions=-DSTOP.PORT=8079 ++JvmOptions=-DSTOP.KEY=<password> --Install=C:\jetty\jetty8\prunsrv.exe ++StartMode=java --StopMode=java --Classpath=C:\jetty\jetty8\start.jar --StartClass=org.eclipse.jetty.start.Main --StopClass=org.eclipse.jetty.start.Main --StopParams=--stop
All on one line. (The trailing slash is necessary on "C:\jetty\jetty8\logs\" Replace <password> with something only you know. This assumes you want Java7.) Run install_jetty_service.bat on the command line. Test it on the command line:
prunsrv run JettyService
If that works, you should be able to start/stop it with the regular control panel GUI. More info: http://commons.apache.org/proper/commons-daemon/procrun.html