2

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 1

3

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"

Sign up to request clarification or add additional context in comments.

2 Comments

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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.