java - Why does this file not get deleted? -


this question has answer here:

i trying delete file using file.delete()

here code:

file stagingfile = new file(stagingpath,configfilename); fileoutputstream fos = new fileoutputstream(stagingfile); int c = 0; while((c=input.read())!=-1){     fos.write(c); } fos.flush(); fos.close(); input.close(); 

and after performing operations, this:

boolean delete = stagingfile.delete(); 

delete returns false. far can see i've closed handlers relating stagingfile. i'm not sure why doesn't deleted

from file.delete docs:

note files class defines delete method throw ioexception when file cannot deleted. useful error reporting , diagnose why file cannot deleted.

give this method (files.delete(path)) shot.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -