List of usage examples for java.lang System setSecurityManager
public static void setSecurityManager(SecurityManager sm)
From source file:MainClass.java
public static void main(String args[]) throws IOException { System.setSecurityManager(new MySecurityManager()); }
From source file:Main.java
public static void main(String[] args) throws Exception { if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); }//from www .j a v a 2 s. c o m }
From source file:AuthorizedFileWriter.java
public static void main(String[] args) { System.setSecurityManager(new SecurityManager()); String file = "authorized.txt"; String fileBody = "test"; try {/* ww w .ja v a 2s . com*/ FileWriter fileWriter = new FileWriter(file); fileWriter.write(fileBody); fileWriter.close(); System.exit(0); } catch (IOException ioException) { ioException.printStackTrace(); System.exit(1); } }
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); sm.checkLink("JDBC"); 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 SecurityManager(); System.setSecurityManager(sm); sm.checkAccept("www.java2s.com", 8080); 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 SecurityManager(); System.setSecurityManager(sm); // perform the check sm.checkDelete("test.txt"); 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 SecurityManager(); System.setSecurityManager(sm); // perform the check sm.checkConnect("www.java2s.com", 8080); 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 SecurityManager(); System.setSecurityManager(sm); // perform the check sm.checkExec("notepad.exe"); 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 SecurityManager(); System.setSecurityManager(sm); // perform the check sm.checkAwtEventQueueAccess();//from ww w .ja v a 2s. 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 SecurityManager(); System.setSecurityManager(sm); Object con = sm.getSecurityContext(); System.out.println(con);/*from www. j a v a 2 s. co m*/ }