Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can java find out if a windows service is installed?

843829Mar 16 2007 — edited Mar 31 2007
Does 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2007
Added on Mar 16 2007
2 comments
474 views