Access check on folder in java

Posted by Bhaskar on Stack Overflow See other posts from Stack Overflow or by Bhaskar
Published on 2012-04-15T11:27:07Z Indexed on 2012/04/15 11:28 UTC
Read the original article Hit count: 159

Filed under:

I'm using the following code to check the access on selected folder. but it's not working.

private boolean writeAccess(String path){
    try {
        AccessController.checkPermission(new FilePermission(path, "read,write"));/*,*/
        // Has permission
        return true;

        } 
    catch (SecurityException e) {
        // Does not have permission
        return false;
    }   
}

wt is prblm in it. and is there any other options to check the existance and access on the folders/directories?

© Stack Overflow or respective owner

Related posts about java