PRB: System.exit() Causes a SecurityExceptionEx

SYMPTOMS

Calling the System.exit() method from a distrusted applet causes a security
exception.

CAUSE

An untrusted applet cannot call System.exit() because it causes the
browser to shut down.

RESOLUTION

If your program needs to call System.exit(), you must make the applet
trusted.

STATUS

This behavior is by design.

MORE INFORMATION

The sample code below generates the following security exception:


com.ms.security.SecurityExceptionEx[SystemExit.action]

Sample Code

import java.awt.*;public class SystemExit extends java.applet.Applet{  public void init()  {     add(new Button("Exit"),"Center");  }  public boolean action(Event e, Object o)  {     System.exit(0);     return true;  }}

REFERENCES

For additional information, please refer to the following Knowledge Base article:


For additional information on making your Java Code trusted in MicrosoftInternet Explorer, click the article number below
to view the article in the Microsoft Knowledge Base:

193877 HOWTO: Make your Java Code Trusted in Internet Explorer
For more information on making your applet trusted, please see the
Microsoft SDK for Java 2.0x documentation, available at
http://www.microsoft.com/mscorp/java/.

For the latest Knowledge Base articles and other support information on
Visual J++ and the SDK for Java, see the following pages on the Microsoft
Technical Support site:

Propiedades

Id. de artículo: 179853 - Última revisión: 02/14/2017 - Revisión: 1

Microsoft Virtual Machine for Java, Microsoft Software Development Kit for Java 1.5, Microsoft Software Development Kit for Java 1.51, Microsoft Software Development Kit for Java 2.02, Microsoft Software Development Kit for Java 2.02, Microsoft Software Development Kit for Java 2.01, Microsoft Software Development Kit for Java 2.02, Microsoft Software Development Kit for Java 2.02, Microsoft Software Development Kit for Java 3.0, Microsoft Software Development Kit for Java 3.1

Comentarios