I am using java Runtime.exec() method to execute bat file,in bat file i have write code that execute jar.This jar contain thread class that pooling infinite time the rabbitmq queue,if message are found then perform operation on that,mean the process will run infinite. i want to kill this process using java code,also i want know that can this method are able to execute shall script on Linux Os.
**Used java code**
String myCMD = "cmd.exe /C start c:\\elasticmgmtservice.bat";
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(myCMD);
**used batch file**
cd c:
cd ElasticMgmtService\
java -jar ElasticIndexManagementService.jar config\ElasticIndexManagementService.xml
please help me to solve the problem.