You can use aWatchService
:
An implementation that monitors events from the file system is intended to directly map to the event notification tool based on its own file, if any, or to use a primitive mechanism such as polling when a native object is unavailable
You can also look at the tutorial , which confirms that the point
. API Watch Service , . , , ,