List of usage examples for java.lang System setSecurityManager
public static void setSecurityManager(SecurityManager sm)
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); ThreadGroup con = sm.getThreadGroup(); System.out.println(con);// w w w.j av a 2 s .c o m }
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.checkPrintJobAccess();/*from ww w. j av a2 s.c o m*/ System.out.println("Allowed!"); }
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!"); }
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.checkPropertiesAccess();// w w w . ja v a2 s.c o m System.out.println("Allowed!"); }
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.checkPropertyAccess("java.runtime.name"); System.out.println("Allowed!"); }
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); boolean checked = sm.checkTopLevelWindow("Window"); System.out.println(checked);//from w w w .ja va2 s . c o m }
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.checkSystemClipboardAccess();/*from ww w. ja va 2 s . c om*/ System.out.println("Allowed!"); }
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.checkSetFactory();/* w w w. j a v a 2 s . co m*/ System.out.println("Allowed!"); }
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); Class[] con = sm.getClassContext(); for (int i = 0; i < con.length; i++) { System.out.println(con[i]); }//from w ww . jav a 2s. c om }
From source file:Main.java
public static void main(String[] argv) throws Exception { System.setProperty("java.version", "data"); try {/*from www. j a v a 2 s . c o m*/ SecurityManager sm = new SecurityManager(); System.setSecurityManager(sm); } catch (SecurityException se) { se.printStackTrace(); } // no longer possible; an AccessControlException is thrown System.setProperty("java.version", "malicious data"); }