Registry / utility / directory-watcher

directory-watcher

JSON →
library0.19.1javamavenunverified

A Java library for watching file system directory changes using the WatchService API.

<dependency> <groupId>io.methvin</groupId> <artifactId>directory-watcher</artifactId> <version>0.19.1</version> </dependency>
INSTALL
IMPORT
SIG · DIRECTORY-WATCHER
D
directory-watcher
utilityjavav0.19.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DirectoryWatcher
✓ io.methvin.watcher.DirectoryWatcher

Minimal usage of Directory Watcher

import io.methvin.watcher.DirectoryWatcher; import java.nio.file.Paths; public class Example { public static void main(String[] args) throws Exception { DirectoryWatcher watcher = DirectoryWatcher.builder() .path(Paths.get("/path/to/watch")) .listener(event -> System.out.println("File changed: " + event.path())) .build(); watcher.watch(); } }
Debug
Known issues
gotchaOn macOS, WatchService may have limitations; consider using polling mode.
fix
Use DirectoryWatcher.builder().watchService(new PollingWatchService()) for macOS.
affects: *
Upgrade
Version history
0.19.1latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
directory-watcher — mvn dependency:get directory-watcher · libregistry