Re: how to set a file to read only using java
Posted By:
Tim_Rohaly
Posted On:
Wednesday, May 16, 2001 08:49 AM
Java, of course, gives you no way to bypass the inherent
permission scheme built into your operating system.
You can't give yourself superuser privilege simply by
creating an appropriate policy file - that would be an
unforgivable security hole. File.setReadOnly()
will work only if your user/program has the appropriate permission
from the operating system to change the permission
on that specific file. If you want it to work, log in as
a user who does have permission and run your program
again.