JMagick Error when trying to load a file - UnsatisfiedLink
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) {
lo开发者_JS百科gger.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.
精彩评论