Ask Your Question
0

OpenCV 4.5.0 Compile errors

asked 2020-11-30 03:48:01 -0600

updated 2020-11-30 04:56:42 -0600

berak gravatar image

I was able to successfully build the new OpenCV Version using cmake with the following commands: cmake -D BUILD_SHARED_LIBS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D WITH_PNG=OFF . make -j

I added the opencv-450.jar file to the dependencies and copies all files from opencv/build/lib to /usr/lib. However, when compiling my project with this library, I get the following errors:

Error:(14, 26) java: cannot access org.opencv.imgproc.Imgproc bad class file: /.../opencv/opencv-450.jar!/org/opencv/imgproc/Imgproc.class class file has wrong version 58.0, should be 55.0 Please remove or make sure it appears in the correct subdirectory of the classpath.

I use unix and java 11. Before upgrading I used OpenCV4.2.0. Any help is appreciated!

edit retag flag offensive close merge delete

Comments

class file has wrong version

this is a java problem, not really an opencv one.

it seems, you built the opencv.jar with a newer sdk, than you use for your final program. can you check for multiple java sdk's on your box ?

berak gravatar imageberak ( 2020-11-30 05:02:13 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-12-02 05:15:36 -0600

updated 2020-12-02 05:17:12 -0600

Thanks, that's the solution. Yes, I have multiple java jdks installed. I build openCV with java 14. But used java 11 to build my project.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-11-30 03:48:01 -0600

Seen: 1,388 times

Last updated: Nov 30 '20