java.library.path中没有opencv_java300 [英] NO opencv_java300 in java.library.path

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

问题描述

先谢谢了.

我有一个使用 opencv-300.jar 作为外部库的项目.我已经在eclipse和 natBeans 中进行了尝试.当我从IDE本身运行项目时,两者都可以成功运行. 我希望我的项目将其导出为可运行(或可执行)的jar. 我将 opencv_java300.dll 文件与主Java文件一起放置在源文件夹中,并在

I have a project that uses opencv-300.jar as external library. I have tried this in eclipse and in natBeans. In both it is working successfully when I am running my project from IDE itself. I want my project to export it as a runnable (or executable) jar. I placed my opencv_java300.dll file in source folder with main java file and given its name in

 System.loadLibrary("opencv_java300");

我将opencv-300.jar放在外部jar库和Main程序所需的所有其他文件中.从IDE运行时,它成功运行,但是当我创建可执行jar时,它显示错误

I placed opencv-300.jar in external jar libraries and all other files which are needed in Main program. it is working successfully when running from IDE but when I am creating executable jar, it shows an error

   Exception in thread "main" java.lang.UnsatisfiedLinkError: no     
   opencv_java300 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 CropFaceImage.main(CropFaceImage.java:27)

请告诉我,有什么方法可以在程序本身中提供 java.library.path .即使我已经删除了外部库中 opencv_java300.dll 文件的路径,我的项目仍能正常工作.

Please tell me Is there any way to give java.library.path in program itself. My project is working sucsessfully even when I have removed path for opencv_java300.dll file in external library.

推荐答案

我试图传递包含 opencv 路径的命令,但没有找到其他方法.我以某种方式尝试了一些创建我的jar的程序,它可以正常运行.我复制了opencv_java300.dll文件,并将其放在我的jar文件旁边的目录中,并对所有支持文件进行了相同的处理. 我用下面的代码来做到这一点.

I tried to pass the command which contains path for opencv but I found no other way. Somehow i tried something which created my jar and it is properly running. I copied the opencv_java300.dll file and put it in the directory which is next to the my jar file and did same for all supporting files. I used following code to do so.

String opencvpath = System.getProperty("user.dir") + "\\files\\";
String libPath = System.getProperty("java.library.path");
System.load(opencvpath + Core.NATIVE_LIBRARY_NAME + ".dll");

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

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