Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

File locking issue

807605Aug 16 2007 — edited Aug 23 2007
hi ,

I use a java applet for ftp images upload using a third party ftp API library (edtftpj).
i run my applet from browser but I'm experiencing a strange issue :
-i upload a file & leave the browser opened.
-i then open this same file with gimp or photo-shop & get 'file in use' error.
-if i close browser & try opening file ,the file is opened correctly.

I investigated the issue more thoroughly and here are my conclusions :

1) First i made sure to close all File's streams in the applet.so I'm sure i eliminated this issue of forgotten opened file streams .
2) also i made sure to close all network connections that might be holding the File lock.

It's clear that another process is still locking the File & preventing access to it.
i used a win32 program (procExp) to monitor active processes . it turned out that javaw.exe is the process that use the File. i was convinced of this fact with a simple experiment : if i destroy the applet (closing applet's browser window -not necessarily all browser instances-) then in this case the file lock is released and i can access and delete File correctly.

my questions :
-How to instruct javaw.exe to release the File lock ? (is that possible at all to do ?)
-is it a bug in JVM ? (i'm using jdk1.4.2)
-or is it an OS centric issue related to windows only ?

i would appreciate your ideas about this problem .

thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2007
Added on Aug 16 2007
10 comments
776 views