There is a code:

File f =new File("myfolder"+File.separator+"myfile.temp"); if(!f.delete()){System.out.println("NOT DELETE " +f);} 

The file is not deleted. Called at the end of the program, in theory, the file no one holds. Tried through try-catch, but the exception does not generate. How can I find out why the file is not deleted?

  • To begin with, enter the debugger inside the delete() method and find out where exactly the false returns. - iksuy
  • four
    check the correctness of the path, it seems to me wrong. - Artem Konovalov
  • Inside the delete () method, security and isInvalid pass. Ie the thing is there. I get the exact path through f.getAbsolutePath (). What is the problem I do not understand. - Kamenev_D
  • one
    or see who is busy with the file - Senior Pomidor
  • one
    So I went the other way and got the same error: The process cannot access the file, as this file is being used by another process. Now I understand why not deleted. I will understand why and who did not release. Thanks to all. - Kamenev_D

0