I have an exe
triggered from within a java swing application. I am able to kill the exe
using "taskkill /PID ProcessID "
when running the application from ECLIPSE IDE . But when i try to run the jar file
for the swing application through a batch file, the exe
doesn't get terminated probably because I am unable to obtain the process ID. I am using windows XP 32 bit. Any help will be greatly appreciated
String sDosCommand = "cmd /c tasklist /FI " + "\"" + "IMAGENAME eq " + sProcessName + "\"" ;
Process process = Runtime.getRuntime().exec(sDosCommand );
This code (modified to get process ID
of one particular process) gives me the Process ID
, which in turn I use in Taskkill
command executed similarly
Thanks and regards Arun Raj