I am creating a Windows service using Apache's procrun, and I'm having difficulty getting it set up properly. I'm using a batch file to execute the procrun install. My question is two fold.
I'm unable to create a service with spaces in the name. This example was taken from Apache and is setting up a prunsrv service install:
prunsrv //IS//TestService --DisplayName="Test Service" \ --Install=prunsrv.exe --Jvm=auto --StartMode=jvm --StopMode=jvm \ --StartClass=org.apache.SomeStartClass --StartParams=arg1;arg2;arg3 \ --StopClass=org.apache.SomeStopClass --StopParams=arg1#arg2
I have an installed service somewhere in C:\Program Files\, which has a space. I need the --Install path to be 'C:\Program Files\prunsrv.exe' to correctly point to the right path. If I don't inclose the path with quotes:
--Install=C:\Program Files\prunsrv.exe
Windows service thinks the install path is:
C:\Program
Which is an invalid location. When I use:
--Install="C:\Program Files\prunsrv.exe" (or) "--Install=C:\Program Files\prunsrv.exe"
Windows service thinks the install path is:
"C:\Program Files\prunsrv.exe"
...which is also an invalid location (it literally tries to execute that path with the quotes.)
Does anyone know how to correctly install a Windows service with spaces in the path?
If further complications arise, it would be nice to have more detailed documentation. Does anyone have any additional documentation for procrun or examples of it being used? The list of resources I have found this far is:
- http://commons.apache.org/daemon/procrun.html
- http://srsprasad.blogspot.com/2010/04/converting-java-class-to-windows.html
- http://kickjava.com/src/org/apache/commons/daemon/SimpleDaemon.java.htm
It looks like a good resource used in other questions is no longer available: http://blog.platinumsolutions.com/node/234