Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-15
11
Medium Priority
?
348 Views
Last Modified: 2013-11-24
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!

0
Comment
Question by:winman_soft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 4

Expert Comment

by:reijnemans
ID: 36542206
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
 

Author Comment

by:winman_soft
ID: 36542218
the java applet is run from the website which I open.
It gets a lock on all the files opened in my program
0
 
LVL 4

Expert Comment

by:reijnemans
ID: 36542241
"my program" is the java applet? how do you open the fiels in "my program"?
0
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

Author Comment

by:winman_soft
ID: 36542267
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 36542331
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
 

Author Comment

by:winman_soft
ID: 36542540
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 36542796
You need to kill the process (Java) that has them open
0
 

Author Comment

by:winman_soft
ID: 36542817
but doing that might effect other programs using java!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36542881
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
 

Accepted Solution

by:
winman_soft earned 0 total points
ID: 36548118
I found a way to close the handle..
http://www.codeproject.com/KB/shell/OpenedFileFinder.aspx
0
 

Author Closing Comment

by:winman_soft
ID: 36572232
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question