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

7

错误信息: java.lang.UnsatisfiedLinkError: java.library.path中没有JMagick at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754) at java.lang.Runtime.loadLibrary0(Runtime.java:823) at 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。
2个回答

2
简单地说,JVM试图找到JMagick使用的本地库,但失败了。要么您根本没有这个本地库,要么它不在JVM正在查找的位置。

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

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

  • 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.


我从这里下载了一个适用于OSX的软件包:http://joggame.com/software/jmagick.html,运行了configure/make/make install命令,一切都很顺利。除此之外,我还需要设置什么才能让Java找到它? - James

2

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接