Use AccessController to check the file permission : AccessController « Security « Java






Use AccessController to check the file permission

  

import java.awt.AWTPermission;
import java.io.FilePermission;
import java.security.AccessController;

public class MainClass {
  public static void main(String args[]) throws Exception {
    FilePermission fp = new FilePermission("c:\\autoexec.bat", "read");
    AccessController.checkPermission(fp);

  }
}

   
  








Related examples in the same category

1.Use AccessController to check the AWT permission
2.Make AccessibleObject Accessible
3.AccessController.doPrivileged(new PrivilegedAction() )
4. ClassLoader java.security.AccessController.doPrivileged(PrivilegedAction action)
5.Security Support
6.Load class
7.Search for resource in different places.
8.Lock request from going up in the classloader hierarchy