'posix:permissions' not supported as initial attribute




Asked on November 28, 2013
Hi All,
I am using   Files.createDirectories as

FileAttribute<Set<PosixFilePermission>> fileAttributes = PosixFilePermissions.asFileAttribute(perms);
 Files.createDirectories(path,fileAttributes);


But got below error.

Exception in thread "main" java.lang.UnsupportedOperationException: 'posix:permissions' not supported as initial attribute
    at sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(Unknown Source)
    at sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source)
    at java.nio.file.Files.createDirectory(Unknown Source)
    at java.nio.file.Files.createAndCheckIsDirectory(Unknown Source)
    at java.nio.file.Files.createDirectories(Unknown Source)

   
   



Replied on November 29, 2013
Hi Anil,

The error you have mentioned comes when PosixFilePermission is run on windows OS.
Windows does not support PosixFilePermission.



Write Answer











©2023 concretepage.com | Privacy Policy | Contact Us