Change file to read only in java really simple, just run next code:


File myFile = new File("c:\\myFile.txt");
myFile.setReadOnly();
System.out.println(myFile.canWrite());