File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes System.exit(0) in destroy() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "System.exit(0) in destroy()" Watch "System.exit(0) in destroy()" New topic
Author

System.exit(0) in destroy()

Sam Cala
Ranch Hand

Joined: Jan 03, 2001
Posts: 147
Hi All,
Getting a problem. Usually in destroy() method, we people free all the resources that were in use by the applet and then closes the JVM by calling System.exit(0). But then, its raising a security exception ??
If I dont call System.exit(0), then there is no exception, but I have several threads running in applet, so in destroy I wanna kill the thread.
Consider this :
I have a chat applet running. Now for every user that connects to the chat applet, the applet creates a new thread. When one of the client wishes to leave the chat applet, I wanna kill the thread for that particular client. How this is going to achieve. Kindly help. !!!
Regards & all the best,

Best wishes,
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
in your destory method of applet just check if the running thread is not null and then just set it to nul it's a nice way to do it. It will kill your thread.


Val SCJP <BR>going for SCJD
 
 
subject: System.exit(0) in destroy()
 
Threads others viewed
Killing the thread
Help !!
Exiting from Applet
how to close an html window by clicking an applet button ?
How Tomcat stops its own server?
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture