【问题标题】:Play Framework: Cannot load the JNotify native libraryPlay Framework:无法加载 JNotify 本机库
【发布时间】:2017-05-20 11:51:19
【问题描述】:

在我的 Windows 10 机器上启动 Play 项目时遇到问题(在 Win 7 上运行良好)

当我执行“激活器运行”时,我得到以下信息:

Error loading library, java.library.path=C:\Program Files\Java\jdk1.8.0_111\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Java\jdk1.8.0_111\bin;C:\Program Files\PostgreSQL\9.6\bin;C:\Program Files\Git\cmd;C:\dev\utils\activator-1.3.5-minimal;C:\Users\shuda\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Heroku\bin;.;C:\dev\projects\energywatch-portal-bk\target\native_libraries\64bits

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

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Ctrl+D to stop and go back to the console...)

[success] Compiled in 1s

我尝试了很多事情都没有成功。我试过改变:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.2")

我得到另一个错误:

java.lang.NoClassDefFoundError: play/Project$
        at com.typesafe.sbt.SbtEchoPlay$.tracePlaySettings(SbtEchoPlay.scala:19)
        at com.typesafe.sbt.SbtEchoPlay$.echoPlaySettings$lzycompute(SbtEchoPlay.scala:16)
        at com.typesafe.sbt.SbtEchoPlay$.echoPlaySettings(SbtEchoPlay.scala:16)
...
Caused by: java.lang.ClassNotFoundException: play.Project$
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at com.typesafe.sbt.SbtEchoPlay$.tracePlaySettings(SbtEchoPlay.scala:19)
        at com.typesafe.sbt.SbtEchoPlay$.echoPlaySettings$lzycompute(SbtEchoPlay.scala:16)
        at com.typesafe.sbt.SbtEchoPlay$.echoPlaySettings(SbtEchoPlay.scala:16)
       ...

所以,这是我目前的环境设置(更改 sbt-plugin 会导致第二个问题)

scalaVersion := "2.10.3" -> 来自 build.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2") -> 来自 plugins.sbt

sbt.version=0.13.1 -> 来自 build.properties

再次,我使用的是 Win 10(64 位)

这里真的需要一些帮助,卡了几天。

【问题讨论】:

  • java -version 的输出是什么?
  • java 版本 "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
  • 在 Windows 上工作是一个巨大的性能问题,不是吗? +

标签: playframework jnotify


【解决方案1】:

该消息意味着 Play 找不到 jnotify 库,因此它将使用内部进程来检查文件更改(即在文件更改时重新编译并重新启动应用程序)。它不应该阻止您使用该框架,但性能可能比使用 jnotify 时更差。

无论哪种方式,您都可以从https://sourceforge.net/projects/jnotify/ 下载JNotify 并安装它(只需将jnotify_64bit.dll 复制到C:\Program Files\Java\jdk1.8.0_111\bin),该消息应该会消失。

【讨论】:

  • 添加,在 64 位 Linux 上:我最终从这里下载:sourceforge.net/projects/jnotify/files/jnotify,它有一个 64 位 Linux 目录和一个文件 libnotify.so,我不得不使用它来猜想jnotify jar 文件。 (仅供参考的 github 链接将我带到该页面:github.com/aerofs/jnotify
  • @manyways 一个详细描述的答案会对linux用户更有帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-01-20
  • 2015-10-15
  • 2014-05-06
  • 1970-01-01
  • 2013-01-24
  • 2013-04-23
  • 1970-01-01
相关资源
最近更新 更多