Alex Rivera | Logout

java.nio.file.WatchEvent gives me only relative path. How can I get the absolute path of the modified file?

Asked 2011-10-18T02:02:46.713
39

I am using Java 7, java.nio.file.WatchEvent along with the WatchService. After registering, when I poll for ENTRY_MODIFY events, I cannot get to the absolute path of the file for the event. Is there any way to get to the absolute path of the file from WatchEvent object?

Edit
Report

1 Answer

-5

String fullPath = path.toString() + "\\"+ event.context().toString();

:D

answered 2013-06-10T10:50:51.400

Your Answer