title: Problems deleting a file with Java (apache commons io)
body: <p>I am calling a C++ Method via JNI which creates two files. A text log file and a pdf file in a given directory. I want to delete these files (if they exist) before executing the JNI method.</p>
  
  <p>I am using Apache commons.io (FileUtils.forceDelete(File file)) for that. When I execute I get an IOException:</p>
  
  <pre><code>java.io.IOException: Unable to delete file: D:\Folder\file.log
  </code></pre>
  
  <p>I check the writable state of the file before fireing the delete method with the File.canWrite() method. It returns true for both the file and the parent dir.</p>
  
  <p>Do you have an idea why I have problems deleting the file? As far as I know the C++ method which is creating the files is closing or unlocking them after the method finishes. Anyway, I don't have access to the source code of the C++ code so I can't check if that is really the case or modify the code.</p>
  
  <p>Thanks, Marco</p>