Running Jetty 7 as Windows Service

前端 未结 7 1771
孤独总比滥情好
孤独总比滥情好 2020-12-13 10:01

Did Jetty 7 drop support to run as a service using Java Service Wrapper? What options do I have now?

7条回答
  •  有刺的猬
    2020-12-13 10:46

    If you are in a bit of a locked down environment and need to stay within the Microsoft provided tool set, then srvany, instsrv and sc are your friends. Unfortunately it often includes making registry edits. The nice thing is it's very flexible.

    Here's what I did recently to auto-start a Selenium Grid hub server.


    Copy srvany.exe into c:\tools\srvany\srvany.exe

    Open cmd window as admin and run:

    $ cd C:\tools\srvany
    $ sc create "Selenium Grid Hub Server" binPath= c:\tools\srvany\srvany.exe DisplayName= "Selenium Grid Hub Server"
    

    RegEdit

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Selenium Grid Hub Server

    Add a new key named Parameters Under that key, add 3 new String Values named:

    • Application => ${JAVA_HOME}/bin/java.exe
    • AppParameters => -jar selenium-server-standalone-2.42.2.jar -role hub
    • AppDirectory => C:\tools\selenium

    Credit for this goes to http://codeforjava.blogspot.com/2010/12/run-java-application-as-windows-nt.html

提交回复
热议问题