So far, I have used my application as a standalone product. Therefore, when the user clicked the Stop button, I called System.exit(0);and everything was fine.
Now my application will be called (programmatically) from another program. Therefore, I am afraid that System.exit(0);not only my process will kill, but also the external software that launched my program.
So, what is the correct way to disconnect my application if a corresponding request is received from external software? My application is a graphical application. So, I want to close the window, but I also want to close all the processes performed by my program.
ADDED:
To be more specific, I want to close all threads launched by my program. My program does not start any OS process or any other program.
Roman source
share