线程"main"中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有opencv_java249 [英] Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path

查看:781
本文介绍了线程"main"中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有opencv_java249的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在32位笔记本电脑上设置OpenCV,但我不断收到一条错误消息,这使我感到困惑:

I'm currently trying to set up OpenCV on my 32-bit laptop, but I keep getting an error message which is confusing me:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at hello.main(hello.java:8)

我尝试过一些操作,例如进入用户库并将本机库位置更改为\ x64而不是\ x86,但这没有用.我还确保我的Java项目将OpenCV-2.4.9作为其库之一.我也尝试过清理"所有项目,但这没有用(曾经吗?).因此,我已按照设置教程中的所有说明进行操作,但仍然无法正常工作.

I've tried switching a few things around, like going into User Libraries and changing the Native Library Location to \x64 instead of \x86, but that hasn't worked. I've also made sure that my Java project has OpenCV-2.4.9 as one of its libraries, which it has. I've also tried 'cleaning' all projects, but that hasn't worked (does it ever?). So I've followed all the instructions in the set-up tutorial but it still isn't working.

有人知道这可能是什么问题吗?预先感谢...

Does anyone know what the problem might be here? Thanks in advance...

推荐答案

问题是无法找到本机opencv库,因为它不在java.library.path中(它是本机库,通常不应使用Java类路径,但必须在java.library.path中.)

The problem is that the native opencv library cannot be found because it is not in the java.library.path (it is a native library and it should not be in usual java classpath, but it must be in the java.library.path).

您的opencv发行版应包含:

Your opencv distribution should contains:

  • 一个Java库:opencv249.jar.该库主要是Java到本机库,带有jni内容,使您可以从Java代码进行本机调用.它必须在类路径中(并根据您的错误和您的解释:它在类路径中->一切正常,在这里)

  • a java library : opencv249.jar. This library is mainly a java to native library with jni stuff allowing you to do native calls from java code. It must be in the classpath (and according the error you have and your explanations : it is on your classpath --> everything is ok here)

一个名为libopencv_java249.so的本机库,该库必须位于您的java.library.path中.显然:不是:UnsatisfiedLinkError是缺少本机库的症状.要包含此本机库,请使用以下参数启动Java程序:

a native library named libopencv_java249.so and this must be in your java.library.path . Obviously : it is not : the UnsatisfiedLinkError is the symptom of a missing native library. To include this native library: start your java program with the following parameter:

-Djava.library.path =/path/to/the/directory/of/ibopencv_java249.so

-Djava.library.path=/path/to/the/directory/of/ibopencv_java249.so

这篇关于线程"main"中的异常java.lang.UnsatisfiedLinkError:java.library.path中没有opencv_java249的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆