jQuery in Action, 3rd edition
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 Building Microservices this week in the Design 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: 52

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

[OCJP 6]
Henry Wong

Joined: Sep 28, 2004
Posts: 20057

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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Locking files in java.
It's not a secret anymore!