!7 import java.nio.file.*; import static java.nio.file.StandardWatchEventKinds.*; p { final Path path = FileSystems.getDefault().getPath(userHome()); WatchService watchService = FileSystems.getDefault().newWatchService(); final WatchKey watchKey = path.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY, OVERFLOW); while licensed { final WatchKey wk = watchService.take(); print("Key taken"); for (WatchEvent event : wk.pollEvents()) pcall { final Path changed = (Path) event.context(); print("Changed: " + changed); } bool valid = wk.reset(); if (!valid) print("Key has been unregistered"); } }