Applet Shutdown Problem

D

Darol Klawetter

My applet runs in its own window frame after being invoked from a
browser. If I close the applet, the windowClosing event is detected as
it should be. If I close down the browser instead of the applet, then
the applet's windowClosing event is not called even though the applet
closes. I have shutdown code in the windowClosing method and I want
this code invoked whether I close the applet before the browser or the
browser before the applet.

I've tried putting my shutdown code in applet.stop() but the objects I
need for shutdown have already been deallocated and are thus null
values when stop() is invoked.

Any ideas of where I can put my shutdown code?
 
D

Darol Klawetter

Thanks for the link, but it doesn't address my problem.

Regarding your question: The deallocated objects are my
application-specific objects, which are primarily java bean objects. It
appears that they are being unloaded before the applet.stop() is issued.
 
A

Alun Harford

Darol Klawetter said:
My applet runs in its own window frame after being invoked from a
browser. If I close the applet, the windowClosing event is detected as
it should be. If I close down the browser instead of the applet, then
the applet's windowClosing event is not called even though the applet
closes. I have shutdown code in the windowClosing method and I want
this code invoked whether I close the applet before the browser or the
browser before the applet.

IIRC if somebody closes the browser then they kill the JVM.
I don't think you can do anything about that.

Alun Harford
 
D

Darol Klawetter

I've already added a shutdown hook (i.e.,
Runtime.getRuntime().addShutdownHook()) that should get called before
the JVM exits but, for some reason, it's not getting called in this
case.
 
R

Roedy Green

I've already added a shutdown hook (i.e.,
Runtime.getRuntime().addShutdownHook()) that should get called before
the JVM exits but, for some reason, it's not getting called in this
case.

There is a good chance you need to be signed to do that.
 
D

Darol Klawetter

Roedy said:
There is a good chance you need to be signed to do that.


I've given my applet full permission on my machine via the policy file.
Any other ideas?
 
A

Andrew Thompson

Darol said:
Any other ideas? Anyone?

Browsers cannot be relied upon to call Applet.stop(), it is
that simple. If you need more control, wrap the applet in JWS,
then you have the more predictable AppletViewer showing the applet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top