bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.6k stars 1.59k forks source link

Not able to find the library in IntelliJ #698

Closed torrtuga closed 7 years ago

torrtuga commented 7 years ago

I went through what was said in the Read.md, about including the JAR files (although it doesn't say anything simple Java programs). I also went through similar issues that people have faced in the different threads.

I included all the JAR files inside javacv-bin (http://stackoverflow.com/a/21052192/6366458), but the JAR files didn't show in the External libraries folder. And using just this line : IplImage image = cvLoadImage("ImageToCartoon/ElonMusk.jpeg");

It will throw the following error : Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:958) at org.bytedeco.javacpp.Loader.load(Loader.java:759) at org.bytedeco.javacpp.Loader.load(Loader.java:666) at org.bytedeco.javacpp.opencv_core.(opencv_core.java:10) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.bytedeco.javacpp.Loader.load(Loader.java:721) at org.bytedeco.javacpp.Loader.load(Loader.java:666) at org.bytedeco.javacpp.opencv_imgcodecs.(opencv_imgcodecs.java:13) at com.cartoondummy.PictureCleaning.main(PictureCleaning.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) Caused by: java.lang.UnsatisfiedLinkError: no opencv_imgproc in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:958) at org.bytedeco.javacpp.Loader.load(Loader.java:747) ... 13 more

I tried the various solution said by people, like including all the path in the class path also, didn't work. I also just added the JARs mentioned just for mac, didn't work. I also just added the plain opencv.jar (one with size 750KB) , then also did not work.

So is there any solution for this problem. Thanks in advance.

torrtuga commented 7 years ago

Right now, what I did is I included all the JAR files in the Module section, and then all the Modules in the class path. So now it compiles successfully.