I can't delete a file in Java. In my program, I create a file, do something with it, and then I have to delete it. When I call myFile.delete(), it returns false. I have checked the path it is trying to delete and its correct, I also have administrator privileges (I'm working on Windows 7). Here is my piece of code, very simple:
File aux = new File(System.getProperty("user.dir")+"//tmp.ps");
CreatePostScript(aux.getAbsoluteFilePath());
SendToPrinter();
try{
aux.delete();
}
catch(SecurityException ex){
ex.printStackTrace();
}
Edit, I have read some properties of the File object:
canRead() returns false
canWrite() returns false
exists() returns false
getPath() returns the_actual_path_of_the_file
isFile() returns false