Lock file for writing? [duplicate]
Possible Duplicate:
How can I lock a file using java (if possible)
Is it possible to lock file so that other apps cannot write to file but can still run it normally? My target platform is windows.
File yourFile = new File("yourFile.txt");
yourFile.setWritable(false);
Look at FileChannel's lock() API.
精彩评论