How to close the application when System.exit (0) is not working?

I have an application. When I click the Close button, I call System.exit (0) . But by car, this does not fit. This does not happen on several systems.

I read some docs and forums and found that the value of exit () with 0 (zero) int is used for regular exit . and usually this method never returns normally (means closing the application). BUT, if there is a security manager , and its checkExit method does not allow you to exit with the specified status.

No security manager is created in my application, and I also know that by default the application does not have a security manager. That is, the Java runtime system does not automatically create a security manager for each Java application. Thus, by default, the application allows all operations that are subject to security restrictions.

I am also not sure if this is due to the security manager.

Now I want to know two things.

  • Can I successfully close the application with the presence of the system manager, How?

  • Does System.setSecurityManager (null) ; is this the right way to do this?

I need to close my application. Any suggestion?

thanks

Tei kiran

0
source share

All Articles