Gatorhall
Gatorhall

Reputation: 411

How to change the file's permission and last modified in Java?

To my knowledge, Java's File class does not support to change the file's permission and last modified date. Is there any proper way to do this in a cross-platform style?

Upvotes: 3

Views: 3107

Answers (1)

David Z
David Z

Reputation: 131690

I'm looking at the Java 6 documentation, and there is a setLastModified() method, as well as setReadable(...) and setWritable(...) and setExecutable(...) methods (all in the java.io.File class). So yes, there is a way...

Upvotes: 10

Related Questions