Share this page 

File/directory polling to detect changeTag(s): IO Open Source


jpoller (directory poller)
http://jpoller.sourceforge.net/

A general purpose Java component to enable polling on directories and aysnchronously notify client code of incoming files. It's instrumented via JMX and controllable (also) via a JMX agent, like JBoss' JMX console.

JNotify
http://jnotify.sourceforge.net/

JNotify is a java library that allow java application to listen to file system events. JNotify works on both Windows (Windows 2000, XP, Vista) and Linux with INotify support (Kernel 2.6.14 and above).

Java Native Access (JNA)
https://github.com/twall/jna#readme

The goal of the JNA project is to let you access native code from Java while avoiding C and the Java Native Interface.

One example provides notification of file system changes using the mechanism provided by the OS. FileMonitor.java

Call native methods in a DLL from Java (NativeCall)
http://johannburkard.de/blog/programming/java/Call-native-methods-in-a-DLL-from-Java-without-JNI.html

In this blog entry, the package NativeCall is used to call the Windows API to get notification about modification in given folder.

Java 7

Java 7 provides a mechanism to get notification on file change without polling (WatchService).

See this HowTo

The simple (and naive!) approach

Detect file modification

Using Threads and file lookup at regular interval.