Results 1 to 5 of 5
  1. #1
    Bharath_M is offline Member
    Join Date
    Apr 2011
    Posts
    11
    Rep Power
    0

    Default Folder locking by other process/application...

    Hi Friends,

    I'm getting the "Access is Denied" exceptions while trying to create file with help of FileOutputStream in java.

    Please note that,
    - My application has write access to the folder,
    - Target folder isn't read-only,
    - There isn't a folder existing already at the target location with same name as the filename i create

    Still i get this application. One thing i noted is machine restart helps me come out of this problem.

    A standalone program written is able to write file at same application as well..

    Please help me with your thoughts o how can i determine the process/application that is locking my target folder...Is there a way in java to determine this?


    Regards,
    Bharath M

  2. #2
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    You can't determine which program is using the file/folder in Java.
    This is not a problem with Java but with your computer. Some other program is already accessing the file when your program wants to. In Windows 7, the easiest way to determine this is to right click the file and delete it. It will says "Cannot delete, file is open in {PROGRAM NAME}."

  3. #3
    Bharath_M is offline Member
    Join Date
    Apr 2011
    Posts
    11
    Rep Power
    0

    Default

    I agree this isn't a problem with java...but i would rather need a way to know which process is holding a lock over the file/folder...

    Would Process Explorer be handy for this?

  4. #4
    ra4king's Avatar
    ra4king is offline Senior Member
    Join Date
    Apr 2011
    Location
    Atlanta, Georgia, US
    Posts
    396
    Rep Power
    4

    Default

    I haven't used Process Explorer much so I don't know, sorry :(

  5. #5
    lovelesh is offline Senior Member
    Join Date
    Nov 2010
    Location
    Delhi
    Posts
    135
    Blog Entries
    1
    Rep Power
    0

    Smile

    Is your program behaving in this manner:

    After restart of machine, run your program and see if it works?

    If it works only for the first time and from second time onwards it starts giving the exception, then its your program which is causing the trouble.

    Just try this and let us know the program behavior. If this is the case, may be I can help.

Similar Threads

  1. Application Specific folder
    By 123456 in forum Advanced Java
    Replies: 4
    Last Post: 06-14-2010, 09:27 AM
  2. Process.waitFor() method hangs application.
    By simmi in forum New To Java
    Replies: 2
    Last Post: 02-10-2010, 03:35 AM
  3. Replies: 4
    Last Post: 11-26-2009, 09:40 AM
  4. preventing access/locking a folder?
    By solris in forum New To Java
    Replies: 1
    Last Post: 06-29-2009, 12:20 AM
  5. Replies: 2
    Last Post: 11-21-2008, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •