I am using Opencv 3.1.0 with java on Eclipse and trying to run a basic program, however something is wrong with the build path as I am receiving an error. I already added the opencv user library, but when I run something like-
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
System.out.println( "mat = " + mat.dump() );
I get this error-
Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java310 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at OpenCvTester.main(OpenCvTester.java:7)
I added the opencv library using the .jar file, and I have the opencv lib folder as the native library location. I don't know what the problem is here, please let me know. Thanks so much.
got the same error. The solution for me was very simple but difficult to find since it's specific to OS X.
Inside your ..opencv_path/build/lib/ folder RENAME libopencv_310.so to libopencv_310.dylib
Hope that helps.
Reference - http://www.senwang.me/2016/01/28/Mac-Opencv-3-1-0/
Related
I'm trying to create Java software that allows me to start a program and control it through ActiveXComponent. In order to use ActiveXCompnent I downloaded a JAR file named "jacob-1.18". When I am in runtime and I try to start the program this exception occurs:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no jacob-1.18-x64 in java.library.path
How can I solve this problem?
I tried to follow this solution but the error remains:
UnsatisfiedLinkError with JACOB and jre 1.7
Thanks in advance.
I want to get information about video so I come to know that, mediainfo is good option. I try to use it java. So I fins the MediaInfo.java a wrapper around the native library mediainfo.s.0 I have ubuntu 16.04 64bit and the library are also 64bit. I get code from the filebot git project and put the native library in resource path. But still I get the error.
Exception in thread "main" com.mediainfo.MediaInfoException: Unable to
load amd64 (64-bit) native library libmediainfo.so: Unable to load
library 'mediainfo': Native library (linux-x86-64/libmediainfo.so) not
found in resource path`
`Caused by: java.lang.UnsatisfiedLinkError: Unable to load library
'mediainfo': Native library (linux-x86-64/libmediainfo.so) not found in
resource path
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.mediainfo.MediaInfoLibrary.<clinit>(MediaInfoLibrary.java:23)
at com.mediainfo.MediaInfo.<init>(MediaInfo.java:22)
... 1 more
I put both libmediainfo.so.0 and libzen.so.0 in /usr/lib directory in my system and then check.
The error for zen library is solved but the error for mediainfo library is still there. The code to load these library is as below
Library LIB_ZEN = Platform.isLinux() ? (Library) Native.loadLibrary("zen", Library.class) : null;
MediaInfoLibrary INSTANCE = (MediaInfoLibrary) Native.loadLibrary("mediainfo", MediaInfoLibrary.class, singletonMap(OPTION_FUNCTION_MAPPER, new FunctionMapper() {
#Override
public String getFunctionName(NativeLibrary lib, Method method) {
// MediaInfo_New(), MediaInfo_Open() ...
return "MediaInfo_" + method.getName();
}
}));
So I am not able to solve this problem. I try very hard to solve this.
I got scip optsuite from http://scip.zib.de/#scipoptsuite .
It works fine as a standalone program and with the python interface, but I faced the following JNI error when I ran the example.
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jscip-0.1.darwin.x86_64.gnu.opt.spx in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at de.zib.jscip.nativ.jni.JniScipLibraryLoader.loadLibrary(JniScipLibraryLoader.java:7)
at JniKnapsack.main(JniKnapsack.java:34)
The OS is OS X 10.10.5.
I compiled JNI with
make soplex GMP=false
make scip GMP=false ZIMPLE=false
The lib directory for JNI (path-to-scipoptsuite/scip-3.2.0/interfaces/jni/lib) contains the followings, and is referenced by LD_LIBRARY_PATH:
jniinc# -> /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/include
libjscip-0.1.darwin.x86_64.gnu.opt.spx.so*
libjscip.darwin.x86_64.gnu.opt.so# -> libjscip-0.1.darwin.x86_64.gnu.opt.spx.so
libjscip.so# -> libjscip-0.1.darwin.x86_64.gnu.opt.spx.so
liblpispx.darwin.x86_64.gnu.opt.so
libnlpi.cppad.darwin.x86_64.gnu.opt.so
libscip.darwin.x86_64.gnu.opt.so
libsoplex.darwin.x86_64.gnu.opt.so
scip# -> ../../..
scip.jar
soplex# -> ../../../../soplex-2.2.0
I would be happy if you could give me a suggestion.
Accordiong to mueldgog's advice, I changed the extension to jnilib. Then another error occurred:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib: dlopen(/.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib, 1): Library not loaded: lib/liblpispx-3.2.0.darwin.x86_64.gnu.opt.so
Referenced from: /.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib
Reason: image not found
otools says:
Load command 11
cmd LC_LOAD_DYLIB
cmdsize 72
name lib/liblpispx-3.2.0.darwin.x86_64.gnu.opt.so (offset 24)
In a Linux environment, where I successfully run the same command, lld says
liblpispx.linux.x86_64.gnu.opt.so => /.../scipoptsuite-3.2.0/scip-3.2.0/lib/liblpispx.linux.x86_64.gnu.opt.so (0x00002b66b3d35000)
So I think I should fix the reference to the absolute path on OS X, but don't know how to fix it.
Could you give any advice for this?
Hi i have a problem with a jpl interface. I want connect JPL with swi-prolog installed with mac-ports with eclipse. I have a jpl.jar and i have tried to import the jar file in eclipse with build path but i have this error: "no jpl in java.library.path".
So i have copied libjpl.dylib in a /opt/local/lib/swipl-7.1.29/bin/ and when i execute the code i have this error: "Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/local/lib/swipl-7.1.29/bin/libjpl.dylib: dlopen(/opt/local/lib/swipl-7.1.29/bin/libjpl.dylib, 1): Library not loaded: /Users/janw/stable/lib/swipl/lib/x86_64-darwin13.0.0/libswipl.dylib
Referenced from: /opt/local/lib/swipl-7.1.29/bin/libjpl.dylib
Reason: image not found"
After a anoying waste of time i found the solution about that problem.
First of all, its completely necesary to install swi-prolog via macports, if not, as i did, when you point in the
Djava.library.path=/users/rivax/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin13.0.0
this exception will apear
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/rivax/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin13.0.0/libjpl.dylib: dlopen(/Users/rivax/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin13.0.0/libjpl.dylib, 1): Library not loaded: /Users/janw/stable/lib/swipl/lib/x86_64-darwin13.0.0/libswipl.dylib
Referenced from: /Users/rivax/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin13.0.0/libjpl.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at jpl.JPL.loadNativeLibrary(JPL.java:100)
at jpl.fli.Prolog.<clinit>(Prolog.java:85)
at jpl.Query.open(Query.java:286)
at jpl.Util.textToTerm(Util.java:162)
at jpl.Query.<init>(Query.java:198)
at consultasProlog.Consultas.consultaFicheroProlog(Consultas.java:19)
at utilidades.RellenarModelo.ejecutarArchivo(RellenarModelo.java:30)
at javaprolog.JavaProlog.main(JavaProlog.java:30)
Java Result: 1
So follow these steps.
port install swi-prolog on terminal , if you dont have install already macports command not found will apear so go to https://www.macports.org/install.php and install macports.
navigate to the path of swi prolog macports installation which mine is
/opt/local/lib/swipl-6.6.6/lib/x86_64-darwin14.0.0
copy this path and set in java.library.path in the java VM as -Djava.library.path=/opt/local/lib/swipl-6.6.6/lib/x86_64-darwin14.0.0
Now .pl with jpl.jar will be able to execute and the consults will run.
Hope it will help you and every person who find this hell problem.
Cheers frank.
i just started working with JavaCV under MacOSX. I compiled OpenCV with CMake from the latest source and put the path where the libraries are into the -Djava.library.path=\path\to\libraries JVM Argument and added the JavaCV Libraries in my Project Settings. I also tried several other Variation of the Classpath. But when i launch an easy Project to just grab one image from my webcam i get following error:
Exception in thread "Thread-3" java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1758)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at com.googlecode.javacpp.Loader.load(Loader.java:358)
at com.googlecode.javacpp.Loader.load(Loader.java:285)
at com.googlecode.javacv.cpp.videoInputLib.<clinit>(videoInputLib.java:80)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.googlecode.javacpp.Loader.load(Loader.java:305)
at com.googlecode.javacpp.Loader.load(Loader.java:285)
at com.googlecode.javacv.cpp.videoInputLib$videoInput.<clinit>(videoInputLib.java:192)
at com.googlecode.javacv.VideoInputFrameGrabber.start(VideoInputFrameGrabber.java:89)
at webcampong.Grabber.run(Grabber.java:35)
at java.lang.Thread.run(Thread.java:680)
It is due to the compatibility issue of your openCV and javaCV libraries.
Try to download compatible openCV libraries (containing bin folder).
VideoInputFrameGrabber works only under Windows.
As stated in JavaCV's README.txt:
New videoInputLib wrapper and corresponding VideoInputFrameGrabber to capture using DirectShow, useful under Windows 7 where OpenCV and FFmpeg can fail to capture using Video for Windows (issue #58)
I use javacpp and videoinput to manipulate cameras. I got the error 'java.lang.UnsatisfiedLinkError: no jnivideoInputLib in java.library.path' when I call 'videoInput.listDevices()'.
I fix the problem by adding codes like:
org.bytedeco.javacpp.Loader.load(org.bytedeco.javacpp.opencv_highgui.class);
System.out.println(videoInput.listDevices());
you must call 'Loader.load' first before you call other methods, I don't know why.