Ask Your Question
0

I can not run the Java using Opencv on Linux, 64bit

asked 2013-11-18 21:26:46 -0600

mossi gravatar image

Hi. I want to develop Java Program using OpenCv on Linux, 64bit. So I can install the OpenCv,2.4.4 for Linux. And I can compile the Sample Program using OpenCv. But When I try to run the program, I got the following error message. Exception in thread "main" java.lang.UnsatisfiedLinkError: /mnt/sdc/yu/opencv-2.4.4/build/bin/libopencv_java244.so: /mnt/sdc/yu/opencv-2.4.4/build/bin/libopencv_java244.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)

I think this error means the OpenCv Library is for 32bit PC, but I am running the program on 64bit PC. I want to run the program on 64bit. What should I do? I look forward to hearing from you. Sincerely.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2013-11-19 18:06:21 -0600

updated 2013-11-19 18:07:12 -0600

You can easily compile OpenCV yourself, and get 64-bit libraries. I just did that with 2.4.7:

cmake -DLIB_SUFFIX=64 -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_JASPER=OFF -DBUILD_JPEG=ON -DBUILD_OPENEXR=OFF -DBUILD_PNG=ON -DBUILD_TBB=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_FAT_JAVA_LIB=ON -BUILD_NEW_PYTHON_SUPPORT=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_1394=OFF -DWITH_FFMPEG=ON -DWITH_GSTREAMER=ON -DWITH_V4L=ON -DWITH_TBB=ON -DWITH_IPP=OFF -DWITH_CUDA=OFF -DWITH_OPENCL=OFF WITH_OPENGL=OFF -DBUILD_SHARED_LIBS=ON -D WITH_QT=OFF -DBUILD_WITH_DEBUG_INFO=OFF .

(update to suit your needs)

And then:

make -j4

edit flag offensive delete link more

Comments

Thank you for your answer. But it didn't work. I can compile my java file, but when I try to run, it did't work.

The command I input is below.

tar zxvf opencv-2.4.7

cd opencv-2.4.7

mkdir build

cd build

cmake -DBUILD_SHARED_LIBS=OFF ..

sudo make -j4

javac -cp bin/opencv-247.jar Main.java

java -Djava.library.path=lib Main

Then I got the error below /mnt/sdc/yu/opencv-2.4.7/build/lib/libopencv_java247.so: /mnt/sdc/yu/opencv-2.4.7/build/lib/libopencv_java247.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)

Does anyone have any idea what should I do? I'm looking forward to hearing from you. Sincerely.

mossi gravatar imagemossi ( 2013-11-19 23:47:02 -0600 )edit
1

Just now, I could run the program, thank you for your advise. Actually, the Java on my machine was 32bit, not 64bit. So I installed the java for 64bit, then I could run the program. I spent three days for solving this problem, but I am relieved to run the program. Thank you.

mossi gravatar imagemossi ( 2013-11-20 04:37:50 -0600 )edit

Question Tools

Stats

Asked: 2013-11-18 21:26:46 -0600

Seen: 1,056 times

Last updated: Nov 19 '13