Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jniopencv not found #181

Closed
suvenduchakra opened this issue Mar 14, 2016 · 7 comments
Closed

jniopencv not found #181

suvenduchakra opened this issue Mar 14, 2016 · 7 comments

Comments

@suvenduchakra
Copy link

Hi,
I am not able to run this programm getting the following issue.
Please bear with me, I am new jni coding.

[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.UnsatisfiedLinkError: no jniopencv_stitching in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
        at java.lang.Runtime.loadLibrary0(Runtime.java:849)
        at java.lang.System.loadLibrary(System.java:1088)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:597)
        at org.bytedeco.javacpp.Loader.load(Loader.java:438)
        at org.bytedeco.javacpp.Loader.load(Loader.java:381)
        at org.bytedeco.javacpp.opencv_stitching.<clinit>(opencv_stitching.java:22)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at org.bytedeco.javacpp.Loader.load(Loader.java:413)
        at org.bytedeco.javacpp.Loader.load(Loader.java:381)
        at org.bytedeco.javacpp.opencv_stitching$Stitcher.<clinit>(opencv_stitching.java:2705)
        at Stitching.main(Stitching.java:65)
        ... 6 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\inschakra\AppData\Local\Temp\javacpp5478118453570\jniopencv_stitching.dll: Can't find dependent libraries
        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:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:580)
        ... 15 more
@saudet
Copy link
Member

saudet commented Mar 14, 2016

We don't need to know any JNI to get this running, but you should be using Maven. How did you launch Maven?

@suvenduchakra
Copy link
Author

I used command line to launch maven being in the project directory
mvn compile exec:java -Dexec.args="C:\Users\inschakra\Desktop\images\thumb_IMG_4088_1024.jpg C:\Users\inschakra\Desktop\images\thumb_IMG_4089_1024.jpg"

@saudet
Copy link
Member

saudet commented Mar 14, 2016

Could you copy/paste the whole output to the console of that command? Thanks

@suvenduchakra
Copy link
Author

C:\Users\inschakra\Desktop\opencv-test>mvn compile exec:java -Dexec.args="C:\Users\inschakra\Desktop\images\thumb_IMG_4088_1024.jpg C:\Users\inschakra\Desktop\images\thumb_IMG_4089_1024.jpg"

Listening for transport dt_socket at address: 8000
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building stitching 1.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ stitching ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\inschakra\Desktop\opencv-test\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ stitching ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ stitching ---
[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.UnsatisfiedLinkError: no jniopencv_stitching in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
        at java.lang.Runtime.loadLibrary0(Runtime.java:849)
        at java.lang.System.loadLibrary(System.java:1088)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:597)
        at org.bytedeco.javacpp.Loader.load(Loader.java:438)
        at org.bytedeco.javacpp.Loader.load(Loader.java:381)
        at org.bytedeco.javacpp.opencv_stitching.<clinit>(opencv_stitching.java:22)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at org.bytedeco.javacpp.Loader.load(Loader.java:413)
        at org.bytedeco.javacpp.Loader.load(Loader.java:381)
        at org.bytedeco.javacpp.opencv_stitching$Stitcher.<clinit>(opencv_stitching.java:2705)
        at Stitching.main(Stitching.java:65)
        ... 6 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\inschakra\AppData\Local\Temp\javacpp5478118453570\jniopencv_stitching.dll: Can't find dependent libraries
        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:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:580)
        ... 15 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.955 s
[INFO] Finished at: 2016-03-14T14:34:37+05:30
[INFO] Final Memory: 12M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project stitching: An exception occured while executing the Java class. null: InvocationTargetE
xception: no jniopencv_stitching in java.library.path: C:\Users\inschakra\AppData\Local\Temp\javacpp5478118453570\jniopencv_stitching.dll: Can't find dependent libraries -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

C:\Users\inschakra\Desktop\opencv-test>

@saudet
Copy link
Member

saudet commented Mar 14, 2016

I remember now, there's some dependencies missing: bytedeco/javacv#336 (comment)
Add these three lines to the beginning of the main() method.

@suvenduchakra
Copy link
Author

Thanks a lot, Its working now, I have been struggling for last 4/5 days.

@tehseenmayar
Copy link

hello guys
i am trying to write an opencv mat object into xml file to preserve it for later use but i got the following error. i don't know is there any problem with my code or something else.
any type of help would be appreciated..
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path

this is my java code
opencv_core.FileStorage mfs= new opencv_core.FileStorage(String.valueOf(mymagnitude), opencv_core.FileStorage.WRITE);
mfs.open("test.xml", opencv_core.FileStorage.WRITE);
mfs.release();
"mymagnitude" is the mat object which i am trying to write to a file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants