Can java find out if a windows service is installed?
843829Mar 16 2007 — edited Mar 31 2007Does anybody know if there is a simple way for a java program to find out if a named service is installed on windows?
We are using JavaService (http://multiplan.co.uk/software/javaservice) to wrap a java program to run as a windows service and that works just fine.
Now we have another java program which installs, uninstalls, starts and stops this service which also works just fine, except it cant tell if the service has already been installed (and is not running).
I've seen a solution which parses the output of sc.exe and looks for a status string, but I'm worried that could easily break and I'm sure that it wont work on a non-english installation. What I'd like is a pure Java API solution.
If JNI is the only way, Id rather not write it myself, so can anyone recommend an open source existing solution?
We are using java 1.5 on windows xp.
Thanks in advance.
Philip Wilkinson.