0

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!

  • The error message means that it tried to load the native .so library, but for some reason failed (probably due to some link error). Try to extract the .so from the jar and run `ldd ` - are there any unresolved libraries reported? You might want to add some more details to your question, which Play version are you using, which distribution, architecture? – cbley Jun 11 '20 at 07:29
  • Hi @cbley thanks for the answer! I updated the question with the info requested. In short, I'm running Play v2.2.4, on Ubuntu 20.04 64 bits, and it doesn't seem to report any unresolved libraries – Matias Demare Jun 11 '20 at 12:55
  • Wow, 2.2.4 is really old. At least, try to upgrade to 2.2.6. This comment [here](https://github.com/playframework/playframework/issues/2212#issuecomment-255369208) suggests that 2.3.2 fixes such a problem... You might also try the other solutions, like explicitly passing `java.library.path` to play. – cbley Jun 11 '20 at 14:41
  • Yeah, I'm working on a ~10 year old project, and the PO doesn't consider it worth the cost to upgrade the play version. I couldn't find how to pass `java.library.path` to play, how would you do that? – Matias Demare Jun 12 '20 at 17:47
  • Oh wait, it's working. I moved the downloaded .so file to one of the paths in java.library.path and it did the trick. Thanks for the help! – Matias Demare Jun 12 '20 at 17:53

1 Answers1

0

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!