java Windows 7 中的 Javacv UnsatisfiedLinkError

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10790613/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 02:35:32  来源:igfitidea点击:

Javacv UnsatisfiedLinkError in windows 7

javawindows-7opencvjavacvunsatisfiedlinkerror

提问by user1291468

In my project I want to capture image from my webcam.

在我的项目中,我想从我的网络摄像头捕获图像。

I configured step by step following the instructions from this "OpenCV-JavaCV : eclipse project configuration windows 7" blog post.

我按照这篇“OpenCV-JavaCV:eclipse project configuration windows 7”博客文章中的说明逐步配置

After configuration is finished, i tested samples codes and the application found my webcam

配置完成后,我测试了示例代码,应用程序找到了我的网络摄像头

SETUP: Setting up device 0

SETUP:设置设备 0

SETUP: Namuga 1.3M Webcam

设置:Namuga 1.3M 网络摄像头

SETUP: Couldn't find preview pin using SmartTee

设置:无法使用 SmartTee 找到预览图钉

SETUP: Capture callback set

SETUP:捕获回调集

SETUP: Device is setup and ready to capture.

SETUP:设备已设置并准备好捕获。

and then i got an error which is .dll error.

然后我收到一个错误,即 .dll 错误。

I use windows 7 x64.

我使用 Windows 7 x64。

Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: C:\Users\Administrator\AppData\Local\Temp\javacpp153028723186\jniopencv_core.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
at com.googlecode.javacpp.Loader.load(Loader.java:368)
at com.googlecode.javacpp.Loader.load(Loader.java:315)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.googlecode.javacpp.Loader.load(Loader.java:334)
at com.googlecode.javacpp.Loader.load(Loader.java:315)
at com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:158)
at com.googlecode.javacv.VideoInputFrameGrabber.grab(VideoInputFrameGrabber.java:158)
at GrabberShow.run(GrabberShow.java:24)
at java.lang.Thread.run(Unknown Source)

How can i solve this problem?

我怎么解决这个问题?

回答by SL_User

Check whether your Opencv version and JavaCv versions are matching each other. You can check that on the readme file on javacv-bin it specifically say about the required version of the opencv.

检查您的 Opencv 版本和 JavaCv 版本是否相互匹配。您可以在 javacv-bin 上的自述文件中检查它,它专门说明了所需的 opencv 版本。

回答by karlphillip

I faced this problem on Windows XP and Windows 7, and this is how I fixed it on both platforms, using Netbeans 7.2:

我在 Windows XP 和 Windows 7 上遇到了这个问题,这就是我在两个平台上使用 Netbeans 7.2 修复它的方法:

Install all required software:

安装所有需要的软件:

Note: make sure C:\ffmpeg\binis a valid path.

注意:确保C:\ffmpeg\bin路径有效。

  • OpenCV 2.4.2(32-bit): download OpenCV-2.4.2.exeand extract it. Place its content at C:\opencv.
  • OpenCV 2.4.2(32 位):下载OpenCV-2.4.2.exe并解压。将其内容放在C:\opencv.

Note: make sure C:\opencv\build\x86\vc10\binis valid path.

注意:确保C:\opencv\build\x86\vc10\bin路径有效。

  • JavaCV 0.2: download javacv-0.2-bin.zipand extract it. Move the extracted folder to C:\javacv-bin.

  • Microsoft Visual C++ redistributable package(32-bit): download and install vcredist_x86.exe.

  • JavaCV 0.2: 下载javacv-0.2-bin.zip并解压。将解压后的文件夹移动到 C:\javacv-bin.

  • Microsoft Visual C++ 可再发行组件包(32 位):下载并安装vcredist_x86.exe

Configure the environment:

配置环境:

C:\ffmpeg\bin;C:\opencv\build\x86\vc10\bin

C:\ffmpeg\bin;C:\opencv\build\x86\vc10\bin

Now you ready to create a new Netbeans project and test your application. But before you compile it,dDon't forget to right-click the Librariesfolder at the pProjects window* and click Add Jar/FOLDERto select all the .jarfiles located at C:\javacv-bin.

现在您准备好创建一个新的 Netbeans 项目并测试您的应用程序。但在编译之前,d不要忘记在 pProjects 窗口* 中右键单击Libraries文件夹,然后单击添加 Jar/FOLDER以选择位于.jar 的所有.jar文件C:\javacv-bin

回答by Thorbj?rn Ravn Andersen

Unsatisfied link means that not all native code libraries required by jniopencv_core.dll could be found.

不满意的链接意味着无法找到 jniopencv_core.dll 所需的所有本机代码库。

Did you deploy them all or just jniopencv_core.dll?

您是全部部署还是仅部署 jniopencv_core.dll?

回答by Jeff Storey

Make sure you have the vm arg -Djava.library.path=<path-to-native>that points to the directory with your dlls.

确保您拥有-Djava.library.path=<path-to-native>指向包含 dll 的目录的 vm arg 。