Skip to Main Content

Java APIs

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!

java.io.FileNotFoundException: The process cannot access the file because..

541426Aug 31 2012 — edited Aug 31 2012
Hi,
I encountered this problem while working with the Watch Service API in Java 7. I registered a directory with Watch Service to be able to monitor any new files begin created/uploaded via copy or FTP method. The watch service kicks in as soon as it receives the watch key. However, after I obtain the context from the Watch Event when I try to read the file I get "java.io.FileNotFoundException: C:\Documents and Settings\TestUser\logs\test.log (The process cannot access the file because it is being used by another process)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:97)
at com.skis.tests.MsgProcessor.processEvents(MsgProcessor.java:67)
at com.skis.tests.MsgProcessor.main(MsgProcessor.java:184)"

Has any one come across similar problem? All suggestions and advices are welcome.

Thanks in Advance!
skis
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2012
Added on Aug 31 2012
2 comments
5,624 views