How to use native lib in an Eclipse RCP App. (Bundling OpenCV) [message #1722295] |
Wed, 03 February 2016 15:27  |
Eclipse User |
|
|
|
Hello,
I want to use opencv library with its native library in my RCP App. Everything is fine if I add the jar lib in plugin class path using Build Path -> Configure Build Path... etc. and specifying the native library for this jar lib.
Another possibility (the one that I would like to use) is to create a plugin from this jar lib using "create new plugin from external jar archive" and to add Bundle-NativeCode directive to Manifest.MF. Something like that :
Bundle-NativeCode: nativeLibs/libopencv_java300.dylib; osname=MacOSX; processor=x86-64
Then, in the RCP App., I first remove everything from class path and, without changing anything in source code, add this new plugin in plugin dependencies of the RCP App.
Now, when I run the App., opencv library seems to not be correctly loaded (using System.LoadLibrary()) as I have this error message :
org.eclipse.e4.core.di.InjectionException: java.lang.UnsatisfiedLinkError: no opencv_java300 in java.library.path
I've been looking on internet to find an answer but without success. I have missed something but what ?
Please could you help me ?
Thanks a lot,
frank
PS : Everything is done using eclipse-RCP-4.4.2, mac OS X.9.5 and OpenCV 3.0 (OpenCV lib has been compiled on the computer)
[Updated on: Wed, 03 February 2016 17:06] by Moderator
|
|
|
|
|
|
Re: How to use native lib in an Eclipse RCP App. (Bundling OpenCV) [message #1722401 is a reply to message #1722390] |
Thu, 04 February 2016 10:23   |
Eclipse User |
|
|
|
Here is the output of the otool command :
iMac-de-Frank:OpenCV_JAR frank$ otool -L libopencv_java300.dylib
libopencv_java300.dylib:
/Users/frank/OPENCV/SharedLibraries/lib/libopencv_java300.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/System/Library/Frameworks/OpenCL.framework/Versions/A/OpenCL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1265.21.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 20.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1056.17.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
Don't see any missing lib or any version incompatibility
Quote:are you sure you've included the DLL in your bundle? It actually sounds like the file wasn't found rather than an error when resolving the DLL.
What do you mean ?
opencv Jar and dylib files are in the root folder plugin. The jar file is added to the class path of the plugin and there is the Bundle-NativeCode directive.
I've not exported the plugin as a jar. I just test my RCP app. with a dependency link to this previous plugin. Must I do anything else to include the DLL ?
If you have any other ideas... you are welcome
Thanks.
|
|
|
|
Re: How to use native lib in an Eclipse RCP App. (Bundling OpenCV) [message #1722428 is a reply to message #1722406] |
Thu, 04 February 2016 13:47  |
Eclipse User |
|
|
|
Brian,
Quote:
iMac-de-Frank:OpenCV_JAR frank$ otool -L libopencv_java300.dylib
libopencv_java300.dylib:
/Users/frank/OPENCV/SharedLibraries/lib/libopencv_java300.dylib (compatibility version 0.0.0, current version 0.0.0)
yes it's like if the lib was needing itself... I didnt see that. It comes from the folder where I compiled OpenCV. How can it be possible ? I have to look at this compile process... Anyway why would it works when I use this lib with traditional class path ???? Don't think the problem is here. This lib is not in DYLD_LIBRARY_PATH.
EDIT -> otool -L displays also a kind of ID of the dylib itself always at the first line. It is not actually a circular link. I've checked that with other libraries from osx system.
Here is a list of what is displayed under OpenCV_JAR plugin folder in Package Explorer View :
JRE Sys. Lib.
Plug-in Dep.
Ref. Libs.
META-INF
build.properties
libopencv_java300.dylib
opencv-300.jar
Thanks a lot for the link to jmapi,
frank
[Updated on: Thu, 04 February 2016 15:17] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.28836 seconds