title: Grant permission to a particular directory to avoid java.security.AccessControlException
body: <p>I am trying to read a text file after I have set the security manager with a policy file which is-</p>
  
  <pre><code>grant  
  {
    permission java.io.FilePermission "/home/esamsar/NetBeansProjects/FilePermissionDemo/src/cheese.txt", "write";
  };
  </code></pre>
  
  <p>It is working fine but when I add a codebase to it java.security.AccessControlException is encountered everytime.
  My OS is Ubuntu and I have tried the following and all are encountering the same exception.</p>
  
  <pre><code>grant codebase  "file:/home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
  grant codebase  "file://home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
  grant  codebase "/home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
  </code></pre>
  
  <p>Could someone point the proper way to add a codebase to grant permission to a particular directory.
  Thanks in advance.</p>