简体   繁体   English

无法加载 JNotify 本机库(java.library.path 中没有 jnotify)

[英]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我发现这个问题,似乎已经解决了 Windows 用户的问题,但我还没有找到 Linux 机器的解决方案

I tried copying the.jar and.so downloaded from here into /usr/lib/jvm/jdk1.8.0_212/bin/ with no success我尝试复制 .jar 和.so 从这里下载到/usr/lib/jvm/jdk1.8.0_212/bin/但没有成功

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另外,我注意到在我的播放目录( ~/play/repository/local.net.contentobjects.jnotify/jnotify/0.94/jars )中有一个 jnotify.jar,所以我不确定为什么它没有使用那个

I'm using Play v2.2.4, on Ubuntu 20.04 64 bits我在 Ubuntu 20.04 64 位上使用 Play v2.2.4

After extracting the.so from jnotify.jar, the output of the ldd libjnotify.so command was:从jnotify.jar中提取.so后, ldd libjnotify.so命令的output为:

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 libc.so.6ld-linux-x86-64.so.2存在于列出的目录中,我不确定它在哪里寻找linux-vdso.so.1

Any help is appreciated!任何帮助表示赞赏!

I'll describe how it was solved for the future generations:我将描述它是如何为子孙后代解决的:

First, download JNotify here and unzip it首先,在这里下载JNotify并解压

Then type java -XshowSettings:properties into the terminal, and check the java.library.path property.然后在终端中输入java -XshowSettings:properties ,并检查java.library.path属性。 In my case, the first path listed here was /usr/java/packages/lib/amd64就我而言,此处列出的第一个路径是/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 )最后,将解压后的文件64-bit Linux/libjnotify.sojava.library.path中的目录(在我的例子中是/usr/java/packages/lib/amd64

After restarting play, it worked重启play后就成功了

Thanks again @cbley!再次感谢@cbley!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM