Example usage for java.lang SecurityManager checkSecurityAccess

List of usage examples for java.lang SecurityManager checkSecurityAccess

Introduction

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

Prototype

public void checkSecurityAccess(String target) 

Source Link

Document

Determines whether the permission with the specified permission target name should be granted or denied.

Usage

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);

    sm.checkSecurityAccess("read");

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