Java gets a lock on opened file preventing others to get a write lock

We are opening a website from our application , which has a java digital sign applet running for signing xml files with .pfx.
But due to this ,java gets a lock on all the open files in our program.
We cannot get a write lock on that file using ,
Open App.path & "\" & "BlackBox" & ".LOG" For Random Access Read Write Lock Write As #LOGNUM Len = LOGLEN
It will also not allow to kill that file.
Can anyone explain this behaviour of java and suggest a workaround?

Also, after i read that file in a vb code, it will allow me to get a write lock on that file. strange!

winman_softAsked:
Who is Participating?
 
winman_softConnect With a Mentor Author Commented:
I found a way to close the handle..
http://www.codeproject.com/KB/shell/OpenedFileFinder.aspx
0
 
reijnemansCommented:
Hi

How do you read the file with your java application. Maybe those links are usefull:

http://mohammed-technical.blogspot.com/2011/02/how-to-read-file-without-locking-in.html

regards,

Reijnemans
0
 
winman_softAuthor Commented:
the java applet is run from the website which I open.
It gets a lock on all the files opened in my program
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
reijnemansCommented:
"my program" is the java applet? how do you open the fiels in "my program"?
0
 
winman_softAuthor Commented:
sorry for not being clear...
I have a vb6 application(my program) which opens a website with java applet. But it gets a lock on all the opened files in my program.i.e the vb6 app.
0
 
CEHJCommented:
First of all, you need to find out exactly what's locked and by what:

http://technet.microsoft.com/en-us/sysinternals/bb896655

Let us know what you find
0
 
winman_softAuthor Commented:
thanks for the answer..
I found out that java has a lock on the file using handle..
How to check if there is a lock on the file and close that handle from my program..
I found some info here : http://www.codeproject.com/KB/shell/OpenedFileFinder.aspx
0
 
CEHJCommented:
You need to kill the process (Java) that has them open
0
 
winman_softAuthor Commented:
but doing that might effect other programs using java!
0
 
CEHJCommented:
That's true, but it's the only way. A workaround might be to work on copies of the open files and rename them later if necessary
0
 
winman_softAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.