I'm using pdfc api to compare 2 pdf files. After comparison want to delete those files. When I used delete() method its not deleting those files and returning false.
When my code is running i tried to remove those files manually but following error message given by windows
"the action cannot be completed because the file is open in java tm platform se binary"
I think pdfc api is not closing the stream properly thats why files are not getting deleted.
Is there any way to delete files if any other api is using the streams for that file ?
Are you providing the streams to pdfc, or are you just providing Files objects or file names? If you're providing the streams, then it's up to you to close them - preferably in a finally block, or using Java 7's try-with-resources syntax.
There was a bug in the standard Java stuff (in the windows JVM) that made such hacking and working around necessary.
Maybe that bug went away with newer versions.
Fortunately I did not come across this bug, only read about it.
this problem is known and will be fixed in the next version of i-net PDFC which is currently slated for the end of this month. The problem is the usage of FileChannels in the parser, which are not instantly released by Java. the next version doesn't use this type of file access anymore