Short answer
You must install OpenCV (as mentioned in JavaCV requirements) and JavaCV on the system in order to use JavaCV. As you probably installed them for development on your computer the application work, but the other machine probably has not them installed and thus the jar
does'nt work.
Long answer
The problem is not the JavaCV library, which appears to be correctly included into your jar
as shown by the lines:
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
at com.googlecode.javacpp.Loader.load(Loader.java:489)
at com.googlecode.javacpp.Loader.load(Loader.java:431)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
The fact is JavaCV is build on top of OpenCV. OpenCV being a C++ library, the only way to use it from Java is to use JNI calls.
JNI require two components:
- A java library (usually with extension
*.jar
) containing java method that calls native library
- A native library (usually with extension
*.so
for linux or *.dll
for windows) that "do the work", in this case that "use OpenCV library"
The first one is provided by JavaCV and included into your jar
application. The second one is system dependent (Os, architecture, ...) and must be into the java library path.
This is the actual error: it can not find libjniopencv_core.so
into java.library.path
. The jniopencv_core
library is provided by JavaCV too but is installed somewhere on the system (/usr/lib/
for instance) and thus not included into the final jar
.
Even if you find a way to include it into the final application, this library will need to use OpenCV libraries which are not installed on the system too. To summarize the needs:
- JavaCV java library, that will call (with JNI):
- JavaCV native library, that will use:
- OpenCV libraries, that will really do the work.
Without one of this point the application will not work. Thus OpenCV and JavaCV must be installed into the system.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…