Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Exitting Java Swing Based Application Completely on EXCEPTION

807591Mar 11 2008 — edited Mar 11 2008
Hello

I am using a swings application. on a particular exception type I am Hiding the Application Main Framae and would need to close the application. Currently I am doing

catch(CustomException ex) {
			ExceptionDialog.showExceptionDialog(parent.getMainFrame(), ex);
			getMainFrame().dispose();
			System.exit(0);
		}
Closing the Application by calling System.exit(0) (Java VM termination) method, I am afraid will close the application Abruptly. I am afraid this is a dangerouus practice as it may lead to other memory leaks or inconsistencies. Is there a better way to close the Application.

Thanks,
Hemanth
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2008
Added on Mar 11 2008
4 comments
607 views