Search code examples
javalinuxplayframeworkjnotify

Cannot load the JNotify native library (no jnotify in java.library.path)


When I try to run any play project, I'm getting the following warning, and it seems to be making my projects run considerably slower than normal:

Cannot load the JNotify native library (no jnotify in java.library.path)
Play will check file changes for each request, so expect degraded reloading performance.

I found this question, that seems to have solved the issue for Windows users, but I haven't found a solution for Linux machines

I tried copying the .jar and .so downloaded from here into /usr/lib/jvm/jdk1.8.0_212/bin/ with no success

Also, I noticed that in my play directory (~/play/repository/local/net.contentobjects.jnotify/jnotify/0.94/jars) there is a jnotify.jar, so I'm not sure why it is not using that one

I'm using Play v2.2.4, on Ubuntu 20.04 64 bits

After extracting the .so from jnotify.jar, the output of the ldd libjnotify.so command was:

linux-vdso.so.1 (0x00007ffd4c3cd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f94bbed5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f94bc2df000)

It doesn't seem to list any unresolved libraries (though I'm not sure how to interpret that output). libc.so.6 and ld-linux-x86-64.so.2 exist in the directories listed, and I'm not sure where it looks for linux-vdso.so.1

Any help is appreciated!


Solution

  • I'll describe how it was solved for the future generations:

    First, download JNotify here and unzip it

    Then type java -XshowSettings:properties into the terminal, and check the java.library.path property. In my case, the first path listed here was /usr/java/packages/lib/amd64

    Finally, move the unzipped file 64-bit Linux/libjnotify.so to the directory in java.library.path (in my case, /usr/java/packages/lib/amd64)

    After restarting play, it worked

    Thanks again @cbley!