I am using java 8 on linux ubuntu 12.04 following the guidelines Watching a Directory for Changes (The Java™ Tutorials > Essential Classes > Basic I/O)
This works but I notice that once I cancel a watchkey with watchkey.cancel() , I seem to be unable to reenable it again. So I can never watch a directory after I have cancelled the corresponding watchkey (even after reboot ) ?
The API Doc says that " Once cancelled, a watch key remains forever invalid."
What does "forever" mean ? There must be a way to re-watch a dir after the key has been cancelled.
Thanks for your help.