I'm writing a Java application that deals with bunches of files and
does various CVS things with them.
I'm wondering how to detect which files (from a list that I keep) have
been changed by outside applications.
One way would be to poll every n seconds. Is this how applications
typically do it? Or is there some way to listen for some sort of
system internal call?
AdTHANKSvance,
Mark
Chris Smith - 22 Mar 2006 06:48 GMT
> One way would be to poll every n seconds. Is this how applications
> typically do it? Or is there some way to listen for some sort of
> system internal call?
Polling is the best you can do in pure Java. It's fairly common for
operating systems to provide a better way, though, if you have a
specific target OS and are willing to suffer the deployment and build
process hassles associated with writing native code.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Roedy Green - 22 Mar 2006 06:52 GMT
>I'm writing a Java application that deals with bunches of files and
>does various CVS things with them.
[quoted text clipped - 5 lines]
>typically do it? Or is there some way to listen for some sort of
>system internal call?
see http://mindprod.com/projects/filefinder.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Oliver Wong - 22 Mar 2006 17:37 GMT
> I'm writing a Java application that deals with bunches of files and
> does various CVS things with them.
[quoted text clipped - 5 lines]
> typically do it? Or is there some way to listen for some sort of
> system internal call?
What some programs do as an *APPROXIMATION* to solving your problem is
to just check for file changes whenever the editor for that file loses, and
regains focus.
Let's pretend your app is a text editor. If I'm typing away in the text
file, but the file gets changed by someone over a network, the app wouldn't
realize it at all and just allow me to keep typing. However, if I alt-tab
out and works with another app, then alt-tab back in, the program would
check upon this regaining of focus, and notify me that the file has been
changed.
- Oliver
Mark Schnitzius - 23 Mar 2006 05:50 GMT
> > I'm wondering how to detect which files (from a list that I keep) have
> > been changed by outside applications.
[quoted text clipped - 13 lines]
> check upon this regaining of focus, and notify me that the file has been
> changed.
Good call. That beats setting up a separate process, in several ways.
I'll probably tackle it that way.
Thanks, Oliver, and everyone else...
--Mark