Windows 2000 and up. ReadDirectoryChangesW
Solaris 11 and up. http://blogs.sun.com/praks/entry/file_events_notification
INotify supported in modern kernels. May need to increase fs.inotify.max_user_watches in /etc/sysctl.conf if /proc/sys/fs/inotify/max_user_watches reports it as too low (default is 8192 on Ubuntu).
Mac OS X
(KQueue also possible; some notes: http://ochafik.free.fr/blog/?p=119)
The KQueue is not suitable for listening on large number of folders as they require file handle to be opened at least in O_EVTONLY. The KQueues are not recursive, even the change of file content has to be monitored by listening on the file not on the folder containing it.
Mac C projects doing FS listening using BSD kernel queues and FSEventStream File:MacFSListening.tgz
I've tested the implementation of the FileMonitor using kqueues (http://ochafik.free.fr/blog/?p=119). To be able to listen on file changes in the folder it listens also on all files inside the folder (it holds file handle to all these files). For a sample project (lucene core sources copied into single folder) there are 722 opened file handles (lsof).
Now implemented directly in NetBeans Platform (API in org.openide.filesystems, implementation in org.netbeans.modules.masterfs) since 7.0; uses JNA on Windows, Mac OS X, Linux (inotify), Solaris (FAM); works on JDK 6 or 7.
Linux, Windows, Solaris.
Supports listening to a full hierarchy where supported by the OS (implemented on Windows), using com.sun.nio.file.ExtendedWatchEventModifier.FILE_TREE. For systems which do not support this natively (Linux), it is straightforward to emulate this at the cost of more watches; this is one of the API usage samples.
Backporting to JDK 6 would have many other advantages (richer API for communication with filesystem); cannot use java.** namespace in that case.
Linux, Mac, Windows. Apache. Uses a separate process (communicates using stdio with main process).
Linux, Mac, Windows. Apache. Semi-active.
Linux, Windows. GPL. Inactive.
Demo in JNA
Just shows that JNA can be used to implement this class of API. Demo implementation only supports Windows.
File:FileSystemWatcher.tgz Implementation of native file system events using JNA based on FSEventStream (Mac OS X 10.5+)