尝试加载文件时出现JMagick错误 - UnsatisfiedLink [英] JMagick Error when trying to load a file - UnsatisfiedLink
问题描述
java.lang.UnsatisfiedLinkError:java.library.path中没有JMagick
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)
at java.lang.Runtime.loadLibrary0(Runtime .java:823)
在java.lang.System.loadLibrary(System.java:1045)
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)
尝试使用代码时
ImageInfo info;
try {
info = new ImageInfo();
//image = new MagickImage(info);
} catch (MagickException e) {
logger.error(InsightsHelper.getStackTrace(e));
}
为什么会发生这种情况?我在OSX上使用eclipse
any ideas why this is happening? I'm using eclipse on OSX
推荐答案
简单的答案是JVM正在尝试查找JMagick使用的本机库,并失败。您根本没有本地库,或者它不是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.
我从这里下载了一个osx软件包:joggame.com/software/jmagick.html运行了configure / make / make install,一切顺利。我还需要为java设置什么才能找到它?
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?
您需要弄清楚make install安装在哪里DLL并告诉Java在正确的位置查找它:
You need to figure out where "make install" installed the native DLL and tell Java to look for it in the right place:
-
如果要从Eclipse中启动,请按照以下步骤操作: trigoman的答案。
If you are launching from within Eclipse, follow the procedure in trigoman's answer.
如果您是从命令行直接或通过脚本启动,那么您需要在您的选项中包含此选项(或等效的) java
命令:
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/ ....
请注意,这是一个JVM选项,必须在classname之前。
Note that this is a JVM option and has to go before the classname.
这篇关于尝试加载文件时出现JMagick错误 - UnsatisfiedLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!