I am creating a directory ("FileAdmin") with the following code:
public class FileAdmin {
private File dir;
public FileAdmin() throws IOException{
this.dir = new File("FileAdmin");
if(!dir.exists() & !dir.mkdir()) throw new IOException();
}
Main does the following:
public static void main(String[] args) {
try{
FileAdmin fa = new FileAdmin();
} catch (Exception e){
e.printStackTrace();
}
}
This is not a problem; when I create a file inside the directory (which succeeds) and try to delete it, I can't. The problem is that mkdir() creates a read-only directory, no matter what I do:
Solo lectura -> read-only
I have already tried dir.setWritable(true);
but it always returns false
. Why is this?
EDIT 1: If I create the dir, uncheck the read-only
option in the folder's properties, once i run the code file is deleted
EDIT 2: I'm using Windows 10