My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

Java 7 has an API to detect file system changes called Watch Service. This project uses JNA to hook into Apple's File System Events API.

This is almost a direct drop-in replacement for Java 7's Watch Service API. I've used the API source code from OpenJDK 7 as much as possible.

There's an example here.

A lot of source code is from OpenJDK.

Differences from Java 7's API

You obtain a Watch Service instance as follows:

WatchService watcher = WatchService.newWatchService();

Instead of creating Path objects, use WatchableFile objects:

WatchableFile file1 = new WatchableFile(new File("/path/to/watch"));

Read the JavaDocs for Java 7's Watch Service API.

There is a tutorial for Java 7's Watch Service API here.

Powered by Google Project Hosting