I've attached the jnotify.jar file
in my referenced libraries (in eclipse).
An error shows up saying:
The libraries cannot be found in "D:/Java/jre/bin"
I copied the jnotify.dll
file to that location, and now file changes are being tracked only within my project directory and not anywhere else on my system.
How do I set it up so that file changes can be tracked from any other directory?
String path = "C:/Users/ansuj/Desktop/testdir"; //does not fix the issue
Remove the dll from your Java bin. the best practice is to put it next to your jar and use
java -jar -Djava.library.path=. something.jar
In Eclipse you can add -Djava.library.path=. to your JVM arguments section in the run dialog screen.