File.canWrite (); file.canRead (); file.canExceute (); always return true, although my file / directory did not have permissions

you need to check the resolution of the used file / directory

 //filePath = path of file/directory access denied by user ( in windows )
 File file = new File(filePath);
 file.canWrite(); 
 file.canRead();
 file.canExecute();

all three return true, but m cannot delete any file / directory

+5
source share
2 answers

You need to check:

SecurityManager.checkDelete(filepath);

As said in JavaDoc

+2
source

Have you tried using the java.nio.file.Files # isWritable method ?

+1
source

All Articles