Example usage for java.lang SecurityManager checkCreateClassLoader

List of usage examples for java.lang SecurityManager checkCreateClassLoader

Introduction

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

Prototype

public void checkCreateClassLoader() 

Source Link

Document

Throws a SecurityException if the calling thread is not allowed to create a new class loader.

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.checkCreateClassLoader();
    System.out.println("Allowed!");
}