AWT : Automatic call to System.exit(0)

Rodrigo Senra rodsenra at correionet.com.br
Tue Jun 15 21:13:19 PDT 1999


Hi,

 I'm facing a behaviour on Kaffe that diverge from other JVM's
 (at least JDK 1.1.6, that I confess is the only one I tried out).

 When the last window is closed System.exit(0) is called, the rest of
 the application never sees daylight.

 I dug a little and found out at class Default a static field AutoStop
 that sets this behaviour as default. Well, at least I'm holding this
 class as responsible.

 Questions ???

 1) The default behaviour shouldn't be the opposite, since Sun JVM is.

    Independently of what Sun standard is I advocate that the default
behaviour
    should not be to destroy the application after the last window
disposal.
    After all, an application that uses windows
                                                  (this has nothing to
do with
    Microsoft...although in their case there is nothing beyond the last
window
    but for a blue screen and a register dump maybe)
  
    might still have something to do after they are destroyed, or may
have
    periods of execution without any window (which is the case of the
app I'm
    currently working on and lead me to that) 

 2) If my supposition is correct, and class Default/field AutoStop is to
    be blamed, how do I set the opposite behaviour without changing
    source and recompiling Kaffe (the visibility of AutoStop is
restricted
    to within the package!) ?

 
 I'm sending a short example to illustrate the problem.

Thanks in advance

Rod Senra
rodsenra at correionet.com.br

//------------------------- minimal(not really minimal ;o) example 
import java.awt.*;
public class bla {
    public static void main(String[] argv) {
	try {	   
	    Frame f = new Frame("Bla");
	    f.pack();
	    f.show();
	    System.out.println("show");
	    Thread.currentThread().sleep(1000);
	    f.dispose();	
            while(true){System.out.println("I was supposed to be printed
out!");}
         } catch(InterruptedException  ex) {
System.out.println("Interrupt"); }	        }
}


More information about the kaffe mailing list