I am trying to read a text file after I have set the security manager with a policy file which is-
grant
{
permission java.io.FilePermission "/home/esamsar/NetBeansProjects/FilePermissionDemo/src/cheese.txt", "write";
};
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.
grant codebase "file:/home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
grant codebase "file://home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
grant codebase "/home/esamsar/NetBeansProjects/FilePermissionDemo/src/*"
Could someone point the proper way to add a codebase to grant permission to a particular directory. Thanks in advance.