0
In Windows 7 I used the following method to start a Windows service in Java:
static final String CMD_START = "cmd /c net start \"";
public static int startService(String serviceName) throws Exception {
return execCmd(CMD_START + serviceName + "\"");
}
However, after I upgraded to Windows 10 this method no longer works. Could help me with a code that starts a Windows service and works on Windows 10?
I believe that the best tool to manage services via command line is SC. However, I do not know if it is available in Windows 10 (I think so). See: http://stackoverflow.com/questions/133883/stop-and-start-a-service-via-batch-or-cmd-file
– cantoni
I tried some of these command and it didn’t work on Windows 10... =/
– Renato Pereira
what error Windows 10 presents?
– cantoni
When trying to start the Tomcat service for example, this appears on the console: The Apache Tomcat service 7.0 Tomcat7 was not started. For more help, type NET HELPMSG 3521.
– Renato Pereira
And you can start normally through the Windows 10 service window, correct?
– cantoni
I can, yes, normally!
– Renato Pereira