java 我如何安装/配置 Xuggle 才不会出现 UnsatisfiedLinkError?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6324478/
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
How do I have to install/configure Xuggle to not get an UnsatisfiedLinkError?
提问by Tyler Petrochko
I am JUST getting started with Xuggle and I downloaded everything into Eclipse and I included them in them in the Referenced Libraries but I made a really simple test,
我刚刚开始使用 Xuggle,我将所有内容下载到 Eclipse 中,并将它们包含在参考库中,但我做了一个非常简单的测试,
package com.xuggle.xuggler.demos;
import com.xuggle.xuggler.IContainer;
public class getContainerInfo {
public static void main (String [] args){
IContainer myContainer = IContainer.make();
}
}
and it throws a bunch of errors,
它抛出了一堆错误,
2011-06-12 16:26:52,142 [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:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
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.xuggler.demos.getContainerInfo.main(getContainerInfo.java:9)
回答by mtyson
Below is what I've found. There is confusion because as of Xuggler 5.2 and greater, you don't need to install it and set the environment variables.
下面是我发现的。存在混淆,因为从 Xuggler 5.2 及更高版本开始,您不需要安装它并设置环境变量。
When looking at the web for answers, you may be confused by finding a mixture of steps from old and new versions. The steps from (B) below, no longer apply.
在网上寻找答案时,您可能会因发现新旧版本步骤的混合而感到困惑。以下 (B) 中的步骤不再适用。
I myself finally fixed the problem by making sure the jar was in the J2EE containers lib, and upgrading from Xuggler 5.2 to 5.4. Thereafter, the link error was gone.
我自己最终通过确保 jar 位于 J2EE 容器库中并从 Xuggler 5.2 升级到 5.4 解决了这个问题。此后,链接错误消失了。
(A) THIS APPLIES TO ALL VERSIONS
From the Xuggler Docs:
(A) 这适用于
来自Xuggler Docs 的所有版本:
Using Xuggler with J2EE Containers
Xuggler contains Native Code and therefore requires special installation with J2EE containers such as Tomcat, Jetty or Glassfish. It must be installed in a location where the J2EE container loads it, rather than a specific web application (unless you can guarantee that your application is the only application in the server that will load Xuggler). You will have to look up the specific documentation for your specific container, but as an example, for Tomcat make sure you install xuggle-xuggler.jar file to $CATALINA_HOME/shared/lib. See tomcat JNI notes for the reason why.
将 Xuggler 与 J2EE 容器
结合使用 Xuggler包含本机代码,因此需要使用 J2EE 容器(如 Tomcat、Jetty 或 Glassfish)进行特殊安装。它必须安装在 J2EE 容器加载它的位置,而不是特定的 Web 应用程序(除非您可以保证您的应用程序是服务器中将加载 Xuggler 的唯一应用程序)。您必须查找特定容器的特定文档,但例如,对于 Tomcat,请确保将 xuggle-xuggler.jar 文件安装到 $CATALINA_HOME/shared/lib。原因请参见 tomcat JNI 注释。
(B) THIS APPLIES ONLY TO XUGGLER PRE 5.2
From: Xuggler Faq:
(B) 这仅适用于 Xuggler PRE 5.2
来自:Xuggler Faq:
What's up with java.lang.UnsatisfiedLinkError?
It means that Java can't find the Xuggler native library. Check the following:
Did you install the Xuggler?
If not, follow the instructions here
- Is the environment variable XUGGLE_HOME defined and pointing to your Xuggler install directory (usually C:\Program Files\Xuggle on Windows or /usr/local on Linux/Mac)?
- If you installed on Windows, did you reboot after you installed? Does your PATH environment variable include %XUGGLE_HOME%\bin on Windows or $XUGGLE_HOME/bin on Linux/Mac?
- Does your PATH environment variable include %XUGGLE_HOME%\lib on Windows?
- Does your LD_LIBRARY_PATH environment variable include $XUGGLE_HOME/lib on Linux?
- Does your DYLD_LIBRARY_PATH environmentvariable include $XUGGLE_HOME/lib on Mac OS-X?
- Are you using a 32-bit Java JVM, but a 64-bit version of Xuggler? Or a 64-bit version of the Java JVM but a 32-bit version of Xuggler? Unfortunately that won't work. You need to make sure that you match the "bitness" of each release. Sorry. If fixing those problems doesn't resolve the issue, please contact us via the Support options.
java.lang.UnsatisfiedLinkError 怎么了?
这意味着 Java 找不到 Xuggler 本地库。检查以下内容:
您是否安装了 Xuggler?
如果没有,请按照此处的说明操作
- 环境变量 XUGGLE_HOME 是否已定义并指向您的 Xuggler 安装目录(在 Windows 上通常为 C:\Program Files\Xuggle 或在 Linux/Mac 上为 /usr/local)?
- 如果您安装在 Windows 上,您安装后是否重新启动?您的 PATH 环境变量是否包括 Windows 上的 %XUGGLE_HOME%\bin 或 Linux/Mac 上的 $XUGGLE_HOME/bin ?
- 您的 PATH 环境变量是否包括 Windows 上的 %XUGGLE_HOME%\lib?
- Linux 上的 LD_LIBRARY_PATH 环境变量是否包含 $XUGGLE_HOME/lib?
- 在 Mac OS-X 上,您的 DYLD_LIBRARY_PATH 环境变量是否包括 $XUGGLE_HOME/lib?
- 您使用的是 32 位 Java JVM,而是 64 位版本的 Xuggler?还是 64 位版本的 Java JVM 但 32 位版本的 Xuggler?不幸的是,这行不通。您需要确保与每个版本的“位数”相匹配。对不起。如果修复这些问题不能解决问题,请通过支持选项与我们联系。
回答by Tyler Petrochko
The issue was that I didn't reboot. Mtyson included this in his answer, so he's correct.
问题是我没有重新启动。Mtyson 在他的回答中包含了这一点,所以他是正确的。