UnsatisfiedLinkError:java.library.path中没有opencv_java249 [英] UnsatisfiedLinkError: no opencv_java249 in java.library.path

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

问题描述

遇到一些问题,在我的mac上运行一段代码。
如果有人给我写了一个图像分析java应用程序,但是当我尝试在netbeans上运行它时我一直收到这个错误。

Running into some problems making a piece of code run on my mac. Had someone write me an image analysis java app but I keep getting this error when trying to run it on netbeans.


run :线程mainjava.lang.UnsatisfiedLinkError中的异常:
java.library.path中的
opencv_java249
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
java .lang.Runtime.loadLibrary0(Runtime.java:870)at
java.lang.System.loadLibrary(System.java:1119)at
image.prossing.Test.main(Test.java:28 )Java结果:1构建成功
(总时间:0秒)

run: Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java249 in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at image.prossing.Test.main(Test.java:28) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)

有netbeans项目,并添加了必要的jar文件作为库。程序员告诉我下载正确的OpenCV版本并将opencv.dll文件复制到我的java / jre / bin文件夹中。但我找不到dll文件或java / jre文件夹。
我知道大多数编程都出现在Windows上是有原因的。希望有人可以帮我解决这个问题并在我的mac上运行这个应用程序。

Have the netbeans project, and added the necessary jar files as libraries. The programmer told me to download the correct OpenCV version and copy the opencv.dll file to my java/jre/bin folder. But I cannot find the dll file or the java/jre folder. I know most programming happens on windows for a reason. Hope someone can help me resolve this issue and run this application on my mac.

这是代码的第一部分,最有可能创建错误的部分:

Here is the first part of the code, the part that is most probably creating the error:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package image.prossing;

/**
 *
 * @author Dumith Salinda
 */
import java.util.ArrayList;
import java.util.List;
import org.opencv.core.Core;
import static org.opencv.core.Core.FONT_HERSHEY_SIMPLEX;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.imgproc.Imgproc;

public class Test {

public static void main(String[] args) {

    System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

如果不是很清楚,请告诉我如果遗漏或不清楚会添加哪些信息。
真的很感激你能给予的任何帮助。真诚的
Meir Warcel

Sorry if it's not that clear, let me know what info to add if something is missing or not clear. Would truly appreciate any help you could give. Sincerely Meir Warcel

推荐答案

查看您的OpenCV目录;

Look into your OpenCV directory;

举个例子; (使用 brew install opencv3 --with-java --with-python3 安装)

For an example this; (installed using brew install opencv3 --with-java --with-python3)

/usr/local/Cellar/opencv3/XXX/share/OpenCV/java

你会看到;

libopencv_javaXXX.so    opencv-XXX.jar

现在您已经拥有OpenCV的Java本机库( libopencv_javaXXX.so ),剩下的就是,mac的动态库

Now that you already have OpenCV's native library for Java (libopencv_javaXXX.so) compiled with you, the only thing left is, mac's dynamic library.

链接 libopencv_javaXXX.so libopencv_javaXXX.dylib ;

ln -s libopencv_javaXXX.so libopencv_javaXXX.dylib

现在添加 / usr / local / Cellar / opencv3 / XXX / share / OpenCV / java 作为 IntelliJ 中的本地库位置或类似的东西。

Now add /usr/local/Cellar/opencv3/XXX/share/OpenCV/java as Native Library Locations in IntelliJ or something similar in Eclipse.

或者将它添加到您的JVM参数中;

Or add this to your JVM arguments;

-Djava.library.path=/usr/local/Cellar/opencv3/XXX/share/OpenCV/java

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

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