I'm using java.io.File methods: setReadable, setWritable, setExecutable to set file permissions. However, in spite of using these methods the permissions are always set to the default settings. Why is that?
1 Answer
These methods are not always supported by the underlying filesystem. E.g. it's not possible to make a point unreadable in NTFS on Windows XP.
There's more information here: www.oracle.com, under "Setting File and Directory Permissions"
2 Comments
Steve Powell
It's not possible to make a file unreadable in Windows NTFS. The methods ought to return
true or false, depending upon whether they worked or not.LarryW
I believe that the article @andewmu linked to has been moved here: More Enhancements in Java SE 6. There's also the java.nio.file.Files class of static methods, added in Java SE 7.