How can I close my software in a save way?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2010-04-21T15:58:43Z Indexed on 2010/04/21 16:43 UTC
Read the original article Hit count: 193

Filed under:
|
|
|

Up to now I used my application as a stand alone product. So, when user pressed "Stop" button I called System.exit(0); and it was fine.

Now my application will be called (in a programmatic way) from another program. So, I afraid that System.exit(0); will kill not only my process but also the external software which started my program.

So, what is the correct way to shutdown my application if a corresponding request from an external software is received? My application is an GUI application. So, I want to close the window but I also want to close all processes performed by my program.

ADDED:

To be more specific, I want to close all threads started by my program. My program does not start any OS process or any other program.

© Stack Overflow or respective owner

Related posts about java

Related posts about exit