Ask Your Question

how to solve the Error: Could not find or load main class in opencv3.0.0 with Java eclipse?

asked 2016-07-14 22:49:20 -0500

Kathy gravatar image

I test the following HelloCV code of opencv3.0.0 with Java Eclipse neon and I got the error "could not find or load main class". How can I solve this?

package againtest;

import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat;

public class HelloCV { public static void main(String[] args){ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); Mat mat = Mat.eye(3, 3, CvType.CV_8UC1); System.out.println("mat = " + mat.dump()); }


edit retag flag offensive close merge delete


Try running just that specific file, not the whole project if you have several files in the project. It might be that Eclipse. Itself has decided which file should be main.

tacocat88 gravatar imagetacocat88 ( 2016-07-19 22:11:50 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-08-18 10:48:21 -0500

vmishin100 gravatar image

Set java.library.path in eclipse java -Djava.library.path=./lib -jar myApplication.jar

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-07-14 22:49:20 -0500

Seen: 309 times

Last updated: Aug 18 '20