Java tutorial
import java.lang.reflect.Member; public class Main extends SecurityManager { // checkMemberAccess needs to be overriden. @Override public void checkMemberAccess(Class<?> clazz, int which) { throw new SecurityException(); } public static void main(String[] args) { System.setProperty("java.security.policy", "file:/C:/java.policy"); SecurityManager sm = new Main(); System.setSecurityManager(sm); sm.checkMemberAccess(Main.class, Member.PUBLIC); System.out.println("Allowed!"); } }