How can I stop and start a windows service from java code

Dear all,

I want to write a Java program that start and stop a windows service on my local machine and also on some servers on the network. I have Windows Server 2003 as operating system.

Thank you,

Ayad
AlqershiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
basav_comConnect With a Mentor Commented:
You can start and stop the services from command prompt using:
net start <ServiceName>
http://www.ss64.com/nt/net_service.html

Use the  Runtime.exec() method to call this from java / Place the start & stop commands in .bat file and call this .bat file using Runtime.exec().
0
All Courses

From novice to tech pro — start learning today.