Results 1 to 4 of 4

Thread: lock a file

  1. #1
    flaca is offline Member
    Join Date
    Aug 2008
    Posts
    3
    Rep Power
    0

    Default lock a file

    please help in the following:

    how can i lock a file with java syntax.
    doing some testing and i know that the file lock will give me an ioexception.

    help is much appreciated.
    thanks.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    What you have tried so far?

    And also better to explain little more about what you trying to work on the file lock. Do you want to change some file attribute?

  3. #3
    mwildam's Avatar
    mwildam is offline Member
    Join Date
    Aug 2007
    Posts
    72
    Rep Power
    0

    Default

    I had the same question time ago (don't know if in this forum) and the explanations were something like: It is not possible to get a reliable file locking because there is no link/integration between java and underlying OS handling of file locks - at least no integration that works on all OSes (the same way).

    But I found this - although not tried myself if it works:
    Thinking in Java 12: The Java I/O System - File locking
    Greetings, Martin Wildam.

  4. #4
    mwildam's Avatar
    mwildam is offline Member
    Join Date
    Aug 2007
    Posts
    72
    Rep Power
    0

    Default

    Here is another link - mentioning that it may behave differently depending on the underlying OS used:
    Java Tips - How to create a file lock on a file
    Greetings, Martin Wildam.

Similar Threads

  1. Replies: 2
    Last Post: 04-07-2009, 07:25 AM
  2. play vedio file and flash file in swing
    By rajasekharreddym in forum AWT / Swing
    Replies: 1
    Last Post: 07-30-2008, 09:22 PM
  3. To open an image file such as Jpeg file using JAva Program
    By itmani2020 in forum Advanced Java
    Replies: 10
    Last Post: 07-11-2008, 10:57 AM
  4. Replies: 7
    Last Post: 05-23-2008, 04:46 AM
  5. object lock question
    By simon in forum New To Java
    Replies: 2
    Last Post: 08-01-2007, 05:36 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
  •