to temporaryDll , it creates files with abcd1234.dll , abcd1235.dll n so on .
The temp directory gets filled up with these number of dlls with diff suffix. Is there any mechanism or any code snippet will I get , to make sure that only one dll will get created n deleted after JVM termination.How can I check in the code , file already exists or not , because at every time it create new filename?
I have tried by deleting all abcdxxxx.dll from temp dir , I ran the code but wondered after watching in temp dir , abcd1234.dll file created instead abcd.dll .
WIN32 JVM does not delete a file that is in open state. To avoid this you might need to close the file before calling deleteOnExit().
However I am using 1.4.2_03 and when I use deleteOnExit(), it does not create the temp files once the process is completed. I guess the bug got fixed. Let me know which version you are using. [ April 17, 2008: Message edited by: Usha Seetharaman ]
Hello, Thanks for your reply. I am using jdk 1.5 . I have already gone through the link sent by you though. What currently I have done is renamed the file to the origional dll after creation i.e. abcd12345.dll to abcd.dll for the first time & reusing that after that.Here I cannt close the file till my application submodules dont need it. By the way is there any workaround for deleting that file other that closing? thanks Ani
Joined: Apr 08, 2008
One option could be once your application starts, i.e. the JVM starts up, delete all temp files you created starting with abcd*.dll since at that moment there are no files open. That might reduce your temp directory getting flooded with these files.