I call the C ++ method via JNI, which creates two files. The text log file and the PDF file in this directory. I want to delete these files (if they exist) before executing the JNI method.
I am using Apache commons.io (FileUtils.forceDelete (file file)) for this. When I execute, I get an IOException:
java.io.IOException: Unable to delete file: D:\Folder\file.log
I check the rewritable state of the file before running the delete method with the File.canWrite () method. It returns true for both the file and the parent directory.
Do you have an idea why I have problems deleting a file? As far as I know, a C ++ method that creates files closes or unlocks them after the method finishes. In any case, I do not have access to the source code of the C ++ code, so I can not check whether this is true, or change the code.
Thanks Marco
Marco nΓ€tlitz
source share