Skip to main content

How to stop Windows service from java source

1 reply [Last post]
acio
Offline
Joined: 2010-01-13

Hi all,

can anybody help? Wanna stop one of running windows services from my java source, run anotger functionality and start that service again.
Which classes I need to use?

Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jtobia
Offline
Joined: 2007-04-23

The easy way, i think is this:
retrive sc.exe utility from microsoft and then ...

getRuntime().exec('[i]...pathName[/i]\sc.exe stop [i]...service...[/i]') //Stop service
.....
getRuntime().exec('[i]...pathName[/i]\sc.exe start [i]...service...[/i]') //Start service