I'm trying execute an taskkill /F /IM
in a .exe that is running before close my java application. But I have differents results between stop and exit my java app. When I stop application, I can see my .exe being closed. But when I try exit the java application (for exemple, executing the java -jar Main
in command line), my .exe does not is closed. See my code:
public class Main extends Thread {
public static void main(String[] args) {
Main main = new Main();
main.start();
}
@Override
public synchronized void start() {
super.start();
// The task done during execution is here.
}
@Override
public void interrupt() {
super.interrupt();
try {
String address = configurator.getValue(FILE_PATH);
Runtime.getRuntime().exec("taskkill /F /IM " + new String[]{address + APP_NAME});
} catch (IOException e) {
e.printStackTrace();
}
}
}
So, what is the difference bettwen stop and exit a java application?