JMagick Error when trying to load a file

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


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.


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.

  • 链接地址: http://www.djcxy.com/p/47522.html

    上一篇: 如何从OpenID / Google获取唯一标识符?

    下一篇: 试图加载文件时出现JMagick错误