File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exiting from Applet" Watch "Exiting from Applet" New topic

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 ");
The above code is throwing Exception.
Can someone help me ?.

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

Joined: Mar 22, 2000
Posts: 13036
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.

author of:
I agree. Here's the link:
subject: Exiting from Applet
It's not a secret anymore!