I am in a situation where I need to monitor a directory for changes
(Basically only when files are created in it) on Windows (NTFS
filesystem) from a long running jruby script.
I would go with the Java 7 solution over a native C extension. Using
Java
directly from JRuby is usually a smoother path than working with C
extensions, plus if you use the Java solution your code should work on
any platform and wouldn’t be a Windows specific solution in case you
ever
needed something different in the future.
I’m using the Java 7 watch service for a small little app at work and it
really didn’t take too long to get it working. These blog posts summed
up
what it does pretty simply:
I know that Headius mentioned JNotify some time ago as an option, and if
you don’t want to use Java 7 for it, this is probably another good
option
that you might be able to: http://jnotify.sourceforge.net/