File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exiting from Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exiting from Applet" Watch "Exiting from Applet" New topic
Author

Exiting from Applet

Shah Chunky
Ranch Hand

Joined: Dec 27, 2000
Posts: 116
Hello all...
I have created an applet with 2 Buttons & on clicking 1 button i want to exit the appletviewer.
Below is the code for ActionEvent:-
public void actionPerformed(ActionEvent e)
{
if (e.getSource()==button)
{
System.out.println("exit ");
destroy();
System.exit(1);
}
}
The above code is throwing Exception.
Can someone help me ?.
Thanks.

Shah Chunky - Sun Certified Java2 Programmer.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12674
    
    5
You exit the appletviewer by closing the window.
System.exit() is not allowed in applets - the reason should be clear after a moment's reflection. The browser JVM may be executing any number of applets in a page, it makes no sense to let one of them stop the system.
Bill

------------------
author of:


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exiting from Applet
 
Similar Threads
System.exit(0) applet
Please help me for Applet Communications!
Error
applets
Can I call System.exit() from an applet ? If so, how ?