List of usage examples for java.lang SecurityManager checkExit
public void checkExit(int status)
SecurityException
if the calling thread is not allowed to cause the Java Virtual Machine to halt with the specified status code. From source file:Main.java
public static void main(String[] args) { System.setProperty("java.security.policy", "file:/C:/java.policy"); SecurityManager sm = new Main(); System.setSecurityManager(sm); // perform the check sm.checkExit(5); System.out.println("Allowed!"); }