JMagick 尝试加载文件时出错 - UnsatisfiedLink

发布于 2024-09-16 08:18:08 字数 513 浏览 4 评论 0原文

java.lang.UnsatisfiedLinkError:java.library.path中没有JMagick 在 java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754) 在 java.lang.Runtime.loadLibrary0(Runtime.java:823) 在 java.lang.System.loadLibrary(System.java:1045)

尝试使用代码时,

ImageInfo info;

    try {
      info = new ImageInfo();
      //image = new MagickImage(info);

    } catch (MagickException e) {
      logger.error(InsightsHelper.getStackTrace(e));
    }

有什么想法为什么会发生这种情况吗?我在 OSX 上使用 eclipse

java.lang.UnsatisfiedLinkError: no JMagick in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)

when trying to use the code

ImageInfo info;

    try {
      info = new ImageInfo();
      //image = new MagickImage(info);

    } catch (MagickException e) {
      logger.error(InsightsHelper.getStackTrace(e));
    }

any ideas why this is happening? I'm using eclipse on OSX

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谈场末日恋爱 2024-09-23 08:18:08

您需要将编译的二进制文件添加到路径中,以便 Eclipse 可以看到它。
首先添加JMagick.jar作为库,然后在项目属性-> Java 构建路径 ->库,单击添加到此项目的 jmagick jar 并编辑“本机库”的位置,在本例中,它将是 libJMagick-6.2.6.dylib 所在的位置,因为这就是您提供的链接说。

You need to add the binaries that you compiled to the path so that Eclipse can see it.
First add JMagick.jar as a library, then in the the project properties-> Java Build Path -> Libraries, you click on the jmagick jar that you added to this project and edit the location for "Native library", which in this case it'll be where libJMagick-6.2.6.dylib is located since that's what the link that you provided says.

蓝眼睛不忧郁 2024-09-23 08:18:08

简单的答案是 JVM 正在尝试查找 JMagick 使用的本机库,但失败了。要么您根本没有本机库,要么它不是 JVM 正在寻找的地方。


我从这里下载了一个用于 osx 的软件包:joggame.com/software/jmagick.html 运行了configure/make/make install,一切顺利。我还需要设置什么才能让 java 找到它?

您需要找出“make install”安装本机 DLL 的位置,并告诉 Java 在正确的位置查找它:

  • 如果您从 Eclipse 中启动,请按照 trigoman 的回答中的过程进行操作。

  • 如果您直接或通过脚本从命令行启动,则需要在 java 命令中包含此选项(或等效选项):

     java -Djava.library.path=/some/folder/ .... 
    

    请注意,这是一个 JVM 选项,必须位于类名之前。

The simple answer is that the JVM is trying to find a native library used by JMagick, and failing. Either you don't have the native library at all, or it is not where the JVM is looking for it.


I downloaded a package for osx from here: joggame.com/software/jmagick.html ran the configure/make/make install and all went well. What else would I have to set up for java to find it?

You need to figure out where "make install" installed the native DLL and tell Java to look for it in the right place:

  • If you are launching from within Eclipse, follow the procedure in trigoman's answer.

  • If you are launching from the command line, directly or via a script, then you need to include this option (or the equivalent) in your java command:

        java -Djava.library.path=/some/folder/ .... 
    

    Note that this is a JVM option and has to go before the classname.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文