Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.nio.file.NoSuchFileException on WatchService

358893Feb 27 2013 — edited Feb 28 2013
Hi,

I am testing a program using Java 7 WatchService to watch a directory and get an error:

java.nio.file.NoSuchFileException: /media/C852-8B2A
java.nio.file.NoSuchFileException: /media/C852-8B2A
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.asIOException(UnixException.java:111)
at sun.nio.fs.LinuxWatchService$Poller.implRegister(LinuxWatchService.java:243)
at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:326)
at java.lang.Thread.run(Thread.java:722)

this exception shows on Ubuntu, but not on Windows.
The exception was correct: the directory was gone. But this exception shows on the console. I would like to catch it. How to catch this exception in my application?

Any information would be appreciated. Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2013
Added on Feb 27 2013
6 comments
1,621 views