This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Locking files in java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Locking files in java." Watch "Locking files in java." New topic

Locking files in java.

sneha ulhe
Ranch Hand

Joined: May 15, 2012
Posts: 45

Is there any way using which we can lock files in simple java...?

[OCJP 6]
Henry Wong

Joined: Sep 28, 2004
Posts: 18509

Never had the need to do this myself, so take with a grain of salt.... Take a look at the FileChannel and FileLock classes.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Vishal Shaw
Ranch Hand

Joined: Aug 09, 2012
Posts: 179
Hi Sneha,

Did you tried the . Hope it helps


Programming is about thinking, NOT coding
jQuery in Action, 2nd edition
subject: Locking files in java.
Similar Threads
Error: cannot resolve symbol
change location of ApplicationResources properties file
Jar files
jar files
ClassNotFoundException in Jsp Precompilation