I am trying to run a batch file which has set of services I want to restart. When I call this batch file from my Java application I get Interrupted Exception.
My batch file
call net stop app-service
call net start app-service
call net stop ui-service
call net start ui-service
call net stop custom-app
call net start custom-app
call net stop MSSQLSERVER /Y
call net start MSSQLSERVER
My java code to run the batch file
File file = new File(System.getProperty("user.dir") + File.separator + "restart.bat");
String time="cmd /c "+file.getAbsolutePath();
Process p = Runtime.getRuntime().exec(command);
int exitvalue = p.waitFor();
I'm getting the following error
java.lang.InterruptedException
at java.lang.ProcessImpl.waitFor(ProcessImpl.java:451)
What am I doing wrong?