JavaCV 1.5 + Gradle + IntelliJ

212 views
Skip to first unread message

Roman Schulte

unread,
Jun 23, 2019, 9:49:30 AM6/23/19
to javacv
Hi @all,

i'm currently trying to get JavaCV running inside IntelliJ using Gradle as build system. I've followed the README of the GitHub repository
and added `compile group: 'org.bytedeco', name:'javacv-platform', version:'1.5' ` to my `gradle.build` file.

After running `gradle build` I can see the library and their (native) dependencies inside the module classpath of the project.

But when I run my application and call `Loader.load(Imgcodecs::class)` in the first line of my main method, i get following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniImgcodecs in java.library.path: [/Users/roman/Library/Java/Extensions, /Library/Java/Extensions, /Network/Library/Java/Extensions, /System/Library/Java/Extensions, /usr/lib/java, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:827)
at java.base/java.lang.System.loadLibrary(System.java:1902)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1336)
at org.bytedeco.javacpp.Loader.load(Loader.java:1077)
at org.bytedeco.javacpp.Loader.load(Loader.java:963)
at MainKt.main(Main.kt:11)

As far as I understand, this means the native library of OpenCV is missing in the classpath, but I'm not sure what I need to do in order to get JavaCV running?
I'm running macOS and can see the `org.bytedeco:opencv:macosx-x86_64:4.0.1-1.5` in the IDE's libraries view.

Did anyone of you face a similiar situation and knows a possible solution?

Greetings,
Roman

Khin Myint Myat Thu

unread,
Jun 23, 2019, 10:27:47 AM6/23/19
to jav...@googlegroups.com
Hi ,
In my case, I sovle with the following code.

System.
loadLibrary("opencv_java")

Regards,
Khin Myint Myat Thu

--

---
You received this message because you are subscribed to the Google Groups "javacv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacv+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javacv/621d2079-4d55-4a75-895e-23a881e6a3d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roman Schulte

unread,
Jun 23, 2019, 4:52:30 PM6/23/19
to jav...@googlegroups.com
Hi Khin,

thanks for your response. Sadly this doesn't work for me.

How did you integrate JavaCV into your project? Via Gradle or manually?

Greetings,
Roman


Am 23.06.19 um 16:27 schrieb Khin Myint Myat Thu:
>> <https://groups.google.com/d/msgid/javacv/621d2079-4d55-4a75-895e-23a881e6a3d6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .

Samuel Audet

unread,
Jun 23, 2019, 8:02:51 PM6/23/19
to jav...@googlegroups.com, Roman Schulte
We actually need to call `Loader.load(opencv_java.class)` as explained
here:
https://github.com/bytedeco/javacpp-presets/tree/master/opencv#documentation

Samuel

Roman Schulte

unread,
Jun 24, 2019, 11:50:34 AM6/24/19
to jav...@googlegroups.com
Thx it worked!

Am 24.06.19 um 02:02 schrieb Samuel Audet:
Reply all
Reply to author
Forward
0 new messages