Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Exiting the VM automatically (without System.exit())
- From: mThornton@xxxxxxxxxxxx (Mark Thornton)
- Subject: Exiting the VM automatically (without System.exit())
- Date: Sat, 29 Jan 2000 09:49:31 -0000
Yes, once you have called Toolkit.getDefaultToolkit() the only way out is via System.exit. There is an RFE to change this. In Java 2, there is a method to enumerate all the frames (Frame.getFrames). Any active windows are either Frames or Dialogs with a frame as their owner. Prior to Java 2, you have to register frames yourself. Regards, Mark Thornton -----Original Message----- From: Benjamin Johnston [mailto:s355171@xxxxxxxxxxxxxxxxx] Sent: 29 January 2000 00:26 To: Advanced Java Subject: Exiting the VM automatically (without System.exit()) Hi, In an application that does not use AWT or Swing, the VM will exit once all threads (where isDaemon()==false) have finished. If I do create a new Frame, and then show it (setVisible(true)), even after hiding and disposing the Frame - the VM will not automatically exit. I think I have traced the problem to Toolkit.getDefaultToolkit() which, on my system, creates an instance of sun.awt.windows.WToolkit. JBuilder's interface decompiler reports that WToolkit imports java.lang.Thread. I'm guessing that WToolkit creates a new, non-daemon thread (but I don't have the source), that never finishes (the event dispatcher thread?). Is it possible to get the system to exit (without calling System.exit(int)) if there are no active (non-daemon) user threads and all windows are disposed (or not visible)? Or, would the only solution be a class (and custom thread group) to keep track of all user threads and windows, and then call System.exit(int) accordingly? Can all active windows created by the VM be enumerated, or must they be registered with some class on creation? -Benjamin Johnston s355171@xxxxxxxxxxxxxxxxx --- To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx --- To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- Prev by Date: problem with fianl & static variable.
- Next by Date: Doubt in using Java Beans
- Previous by thread: Exiting the VM automatically (without System.exit())
- Next by thread: Pls. suggest a free Java Editor / IDE for Win 95/NT
- Index(es):