Check weather a file is in use or not?

Hi,
Hi want to check weather a file is being used by using a command or java code or shell script.
So, can any body give me some idea..

Thanks
Buddhika

Can try it with lsof.

Hi,
I tried to execute "lsof". System says that command not found. I'm using a redhat linux system.
Is this a genaral command?

Thanks
Buddhika

run as root or a uid 0 user.

run the command "updatedb"

then type "locate lsof" it may not be installed. Another option is fuser. run the man on that command