I want to create a windows service with the following command line:
java -jar C:\server\server.jar -conf C:\conf\default.json
I tried something like this: sc create ServerService binPath= "java -jar C:\server\server.jar -conf C:\conf\default.json" DisplayName= "server Service" start= auto
and trying to start my previous created service, an error that the server doesn't start in time request ...
I saw that a windows service must start in a max time before considered timeout.
Is normal because the java command line start a server which never finish because the java process of the server must remains and listening incoming request.
I understood (but my comprehension can be it can be false), I must try to launch the command line and return directly the result in order to the service is considered started. Consequently I tried this:
sc create ServerService binPath= "cmd /c start java -jar C:\server\server.jar -conf C:\conf\default.json" DisplayName= "server Service" start= auto
but always the same error occurred ... do you have a idea how I can do that plz ?
thank a lot and best regards
a windows service which can be start without error and my server up