start windows service from java

后端 未结 5 1383
粉色の甜心
粉色の甜心 2020-12-13 07:05

How can we start/stop a Windows Service from Java? For example, I would like to start and stop the mysql Windows Service from Java.

If start/stop is possible, then i

5条回答
  •  误落风尘
    2020-12-13 07:39

    You may execute following commands via Runtime#exec method.

    net start and net stop (full information is available at : http://technet.microsoft.com/en-us/library/cc736564%28WS.10%29.aspx)

    Probably you will have to use cmd /c net start as it would execute the command under shell.

提交回复
热议问题