6

I want to try JNotify, the plugin library for watching file system changes, but cannot figure out how to configure it. The web page for JNotify says that "java.library.path should point to the location of the native libraries that comes with jnotify (dlls, so dylibs etc)". I am rather new to Mac OS X and don't really know how to do this. I'm using NetBeans and was hoping there was a simple way of adding it to the path in there. I tried it by simply adding the jar file to the Libraries node in the project, and importing it by "import net.contentobjects.jnotify.*;", but that didn't help. I'm getting this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnotify in java.library.path

It also seems I need to add native libraries (.so file for Mac I guess) into the same path.

So how do I do this?

Anders
  • 12,556
  • 24
  • 104
  • 151

2 Answers2

1

java.library.path is a Java system variable, you have to set this particular one by using the -D switch when launching the program:

java -Djava.library.path=/path/to/dylibs your.MainClass

It should be possible to tell Netbeans to add some command line parameters when starting your program somewhere in your project's properties.

On OS X, the directory you want is wherever the .dylib files are, not the .so ones.

millimoose
  • 39,073
  • 9
  • 82
  • 134
  • Ok, I didn't flat out ignore the documentation, I probably just didn't understand it... I thought the java.library.path was like an environment variable under Windows, and that you had to set it somewhere in Mac OS. But I'll try to find a way to set command line parameters in NetBeans and see if I can make it work. Thanks. – Anders Nov 27 '11 at 00:19
  • It worked if I added it in the VM options field of Project > Run. Thank you! – Anders Nov 27 '11 at 00:40
  • I think the default is to set the library path to some environment variable. `PATH` on Windows, `LD_LIBRARY_PATH` on Loonix, I'm guessing on OS X it would be `DYLD_LIBRARY_PATH`. But if you need to enable the JNI libraries for your application alone, the Java system variable is more convenient. – millimoose Nov 27 '11 at 01:21
0

JNotify does NOT work on MAC OSX 10.6.8. As simple as that. :( On Linux works fine! File modified is not correctly reported no matter what you try.

chrisapotek
  • 6,007
  • 14
  • 51
  • 85