Create a read-only file

Samuel picture Samuel · Feb 28, 2012 · Viewed 16.6k times · Source

I was wondering wether it is possible to create or simulate a file with a content set at creation and the assurance that nobody can ever change the file. If possible, can I do it in java?

Answer

Kenneth Funk picture Kenneth Funk · Feb 28, 2012

Setting a file to read only is not going to make it so no one can ever change it. It takes about 3 seconds to unset the read only flag. The file can then be opened in a hex editor or other program that can handle the file type and changes can be made.