I use the java Runtime.exec () method to run the bat file, in the bat file I have a write code that executes jar.This jar contains a stream class that combines the endless time of the rabbitmq queue, if the message is found, then do the operation, this means that the process will be endless. I want to kill this process with java code, also I want to know if this method can execute a 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 solve the problem.
source share