This question was asked three years ago, and the answer was "you can't do that." I'm wondering if this has changed. Here's the question: You can do setReadOnly() on a java.io.File object, but there's no analogous setReadWrite(). In fact, there seems to be no way to control the permissions or attributes of a File object. So, has anybody figured out a workaround? How platform-specific is it? I'm trying to do something on OS/400, and so it will be a little different than anything else, although it will probably most closely resemble some sort of ISO Unix technique. Joe
I think it still can't be done in pure Java. If you are sure of the platform, you can use Runtime.exec(). But that's as platform specific as you can get.
Using Runtime.exec() is probably still the only really good way to do this. What you might do is set up a .properties file contiaining the command/commands to set the permissions. Then, when you move to a different platform, you simply change the .properties file. Not the most elegant solution, but it would mean that you don't have to re-compile code.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.