Example usage for java.lang SecurityManager checkExec

List of usage examples for java.lang SecurityManager checkExec

Introduction

In this page you can find the example usage for java.lang SecurityManager checkExec.

Prototype

public void checkExec(String cmd) 

Source Link

Document

Throws a SecurityException if the calling thread is not allowed to create a subprocess.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.setProperty("java.security.policy", "file:/C:/java.policy");

    SecurityManager sm = new SecurityManager();

    System.setSecurityManager(sm);

    // perform the check
    sm.checkExec("notepad.exe");

    System.out.println("Allowed!");
}