We need to call file.exists() before file.delete() before we can delete a file E.g.
file.exists()
file.delete()
File file = ...; if (file.exists()){ fil
File xx = new File("filename.txt"); if (xx.exists()) { System.gc();//Added this part Thread.sleep(2000);////This part gives the Bufferedreaders and the InputStreams time to close Completely xx.delete(); }