how can i get the file permission of a directory with java
Posted
by
user571652
on Stack Overflow
See other posts from Stack Overflow
or by user571652
Published on 2011-01-11T18:04:04Z
Indexed on
2011/01/11
18:54 UTC
Read the original article
Hit count: 211
i try to check the permission granted to a directory in linux, i mean i have a directory with permission 755
berty@berty-laptop:~$ ls -l / |grep directory drwxr-xr-x 3 root root 4096 2011-01-10 12:33 directory
how can i read that permission with java? I've tried using FilePermission but though i have a directory with all the permissions (777) the FilePermission class always returns an exception
java.security.AccessControlException: Access denied (java.io.FilePermission /home/directory read) at java.security.AccessController.checkPermission(AccessController.java:103) at com.snippets.Check4DirectoryPermission.checker(Check4DirectoryPermission.java:50) at com.snippets.Check4DirectoryPermission.main(Check4DirectoryPermission.java:70)
is there another way to do this?
© Stack Overflow or respective owner