Linux java.lang.UnsatisfiedLinkError:java.library.path 中没有 xuggle-xuggler
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7420771/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.UnsatisfiedLinkError: no xuggle-xuggler in java.library.path
提问by Rauter
I'm using Ubuntu 11.04 and Eclipse. I installed Xuggler succesfully, I've checked the environment variables and everything related with linux in their FAQ: http://wiki.xuggle.comFrequently_Asked_Questions#What.27s_up_with_java.lang.UnsatisfiedLinkError.3F
我正在使用 Ubuntu 11.04 和 Eclipse。我成功安装了 Xuggler,我在他们的常见问题解答中检查了环境变量和与 linux 相关的所有内容:http://wiki.xuggle.comFrequently_Asked_Questions#What.27s_up_with_java.lang.UnsatisfiedLinkError.3F
I also set up Eclipse according to their tutorial: http://xuggle.wordpress.com/2009/01/23/how-to-write-your-first-xuggler-application-in-eclipse/
我还根据他们的教程设置了 Eclipse:http: //xuggle.wordpress.com/2009/01/23/how-to-write-your-first-xuggler-application-in-eclipse/
Whenever I try running any code which uses Xuggler I get the following error:
每当我尝试运行任何使用 Xuggler 的代码时,都会出现以下错误:
2011-09-14 14:17:30,093 [main] ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle-xuggler; version: 3; Visit http://www.xuggle.com/xuggler/faq/ to find common solutions to this problem
Exception in thread "main" java.lang.UnsatisfiedLinkError: no xuggle-xuggler in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:265)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:168)
at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19)
at com.xuggle.xuggler.IContainer.<clinit>(IContainer.java:1457)
at com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137)
at com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
at recode.main(recode.java:16)
So, how to solve this?
那么,如何解决这个问题呢?
采纳答案by Rauter
I got the answer/solution from the xuggler-users google group, credits to Navin Bhutada:
我从 xuggler-users google group 那里得到了答案/解决方案,归功于 Navin Bhutada:
solve it by including the Xuggle variables before runing the netbeans like this:
export XUGGLE_HOME=/home/xyzuser/xuggler
export PATH=$XUGGLE_HOME/lib:$XUGGLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib:$LD_LIBRARY_PATH
/usr/share/netbeans/6.9/bin/./netbeans"
I use eclipse, so I just changed that last line, running eclipse from its folder through the command line and everything worked just fine.
我使用 eclipse,所以我只是更改了最后一行,通过命令行从其文件夹运行 eclipse,一切正常。
Note: If I export the variables and try opening eclipse from a shortcut on my desktop it doesn't work. The shortcut point to the same file I ran from the command line
注意:如果我导出变量并尝试从桌面上的快捷方式打开 eclipse,则它不起作用。快捷方式指向我从命令行运行的同一个文件
TLDR: export variables you got after installing run Eclipse from the terminal.
TLDR:从终端安装运行 Eclipse 后导出的变量。
回答by Teddy Yueh
I've found that even though I may have my environment variables set correctly, explicitly including the Xuggler install dir in the java.library.path when executing saves me from that problem.
我发现即使我的环境变量设置正确,在执行时在 java.library.path 中明确包含 Xuggler 安装目录也可以避免这个问题。
i.e. java -Djava.library.path="$XUGGLE_HOME" myExecutable
IE java -Djava.library.path="$XUGGLE_HOME" myExecutable
回答by Kuangwei Zhang
You just download correct Xuggle from this page based on ur os: http://xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler/5.2/And then extract the lib files to project home folder.
您只需根据您的操作系统从该页面下载正确的 Xuggle:http://xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler/5.2/ 然后将 lib 文件提取到项目主页文件夹。
回答by AVA
Cause Could be un-availability of dependency jars or version conflicts.
原因可能是依赖 jar 或版本冲突不可用。
Adding the following jars in the classpath worked fine for me:
在类路径中添加以下 jar 对我来说效果很好:
xuggle-xuggler-5.4.jar
slf4j-api-1.6.4.jar
logback-core-1.0.0.jar
logback-classic-1.0.0.jar
xuggle-xuggler-5.4.jar
slf4j-api-1.6.4.jar
logback-core-1.0.0.jar
logback-classic-1.0.0.jar
Note: Add them in the library folder using "Add jar/Folder" Option in netbeans.
注意:使用 netbeans 中的“添加 jar/文件夹”选项将它们添加到库文件夹中。