Ask Your Question

please help me in configure the opencv for eclipse juno in java

asked 2013-05-16 01:40:34 -0500

mohammad mehdi gravatar image

updated 2013-05-26 05:34:54 -0500

Andrey Pavlenko gravatar image

i write a test program for opencv in java and i face with this exception my code is:

package ImageProc;

import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;

public class Test {
    public static void main(String[] args) {
        System.out.println("hello opencv");
        VideoCapture capture = new VideoCapture(0);
            System.out.println("Did not connect to camera!");
            System.out.println("Found WebCam :"+capture.toString());
        Mat mat = new Mat();
        Highgui.imwrite("me1.jpg", mat);


in exception is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv-245 in java.library.path
    at java.lang.ClassLoader.loadLibrary(
    at java.lang.Runtime.loadLibrary0(
    at java.lang.System.loadLibrary(
    at ImageProc.Test.main(

for configure,i do this work:

  1. extract the opencv file in location c:
  2. open eclipse and create a project
  3. open the properties and go to java build path
  4. click on the add library button ,then select user library, click user library, click new and create a new library with this name opencv.245
  5. add opencv-245.jar file with click on add external jar file button
  6. and for native library location edit this and set this directory for this: c:/opencv/build/java/x64
  7. click finsih

i run this code and appear this exception please help me

edit retag flag offensive close merge delete


If my solution is working for you: i would appreciate it you accepted it as a solution by clicking the accept sign.

keltik gravatar imagekeltik ( 2013-05-25 17:40:51 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2013-08-21 07:28:00 -0500

Baris Evrim Demiroz gravatar image

Here is a detailed, step by step tutorial on how to use OpenCV with Java+Eclipse: Using OpenCV Java with Eclipse

You can follow it to configure your environment.

edit flag offensive delete link more


This is actually a clear guide. Could you make it into a guide and submit a pullrequest using the how to contribute page?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-21 07:30:23 -0500 )edit

@StevenPuttemans I started working on it. It is very labor intensive to write and even modify a tutorial, so it will take time to make it into the repo.

Baris Evrim Demiroz gravatar imageBaris Evrim Demiroz ( 2013-08-23 09:12:52 -0500 )edit

answered 2013-05-26 05:38:46 -0500

Andrey Pavlenko gravatar image
edit flag offensive delete link more


the link lacks the step with "Native library location" and "add c++ dll", it also confused me when starting to program openCV in java.

keltik gravatar imagekeltik ( 2013-05-26 06:30:28 -0500 )edit

answered 2013-05-22 07:14:07 -0500

keltik gravatar image

updated 2013-05-22 07:14:43 -0500

You have to do this (Step by Step explanation):
1.) Start eclipse, open new Project
2.) right click project, go into "properties"
3.) go into "Java Build path", click add external jars
4.) go into the folder where your jar is placed, "open"
5.) select the newly added jar and expand its "plus-sign"
6.) select "Native library location" and click edit
7.) here select the location where you have stored your c++ dll

If you do not know where your c++ dll and your jar file is:
-download openCV
-unpack it go into folder "build/java" (you will see opencv-245.jar)
-go into "build/java/x86" (you will see your dll)

edit flag offensive delete link more

Question Tools


Asked: 2013-05-16 01:40:34 -0500

Seen: 2,945 times

Last updated: Aug 21 '13