I created a wrapper over JavaLaunchDelegate and created a new ZLaunchConfigurationDelegate extending this . In this wrapper I tried to terminate the previous running Launch using Launch.terminate sometimes it fails to terminate .
Java Code :
public static ILaunch getLaunchObject(String launchName) {
ILaunch launchObj = null;
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = launchManager.getLaunches();
for(int i=0 ; i<launches.length ; i++) {
ILaunch launch = launches[i];
ILaunchConfiguration config = launch.getLaunchConfiguration();
if(config != null) {
String configName = config.getName();
if(configName.equals(serviceName)) {
launchObj = launch;
break;
}
}
}
return launchObj;
}
public static void terminateLaunch(String launchName){
ILaunch launch = getLaunchObject(launchName);
if(launch != null){
launch.terminate();
}
}
terminateLaunch("mylaunch");
I want to force kill the process if launch.terminate will not work .
Goal
If i got the process id from an eclipse launch object . I will kill the process using os command .
Is there any way to get the process id from an launch object?
Thank You ,
Kannan
Try killing all the processes and debug targets (if this Launch is in Debug mode) first and terminate the Launch.