Creating File using Java on Mac

JDK 7 has support for setting File attributes when create a file, So i was testing that out. When i tried to create a file and set security attributes like this

 Set perms = PosixFilePermissions.fromString("rwxrwxrw");
I got the following exception

Exception in thread "main" java.lang.IllegalArgumentException: Invalid mode
 at java.nio.file.attribute.PosixFilePermissions.fromString(
 at com.test.HelloPaths.readWriteFiles(
 at com.test.HelloPaths.main(
It seems that in case of Mac you have to use code like this for file attribute association to work

No comments: