Skip to main content

How to contrl start and stopping of batch script using Java?

1 reply [Last post]
Joined: 2008-08-12

I am having a problem. I hope you can help me out.
I have a requirement in which I am running a 2 tier client-server application over socket communication.
Now based on some message I need to run a batch script on server. This batch script will in turn call a java program. Now the issue is that I need to kill that java program after some time when a message to close that comes in.
I tried following this..
Process p = Runtime.getRuntime().exec("C:\\TradingEdge\\BondLink\\6.1.0\\LoadTestCases\\DevlForwardInquiryReqResTest.bat garot1 10 3 \"UBS,ABN\"" );

}catch(InterruptedException ie){


But this doesnt kill the underlying running java program. I can understand from the that two are separate processes but only if we use some thing like "cmd /c start xxx.bat".

Can you please help how can I achive to shut down that running java program ?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-08-20

Why not have the second java application (the one you want to kill) create a serversocket and when the first application is ready to shut it down it sends a message to that port?