Ask Your Question

opencv_java400.dll: Can't find dependent libraries on windows server

asked 2018-10-31 04:10:48 -0500

bigzai gravatar image

updated 2018-10-31 06:11:25 -0500

berak gravatar image

java code:

   Mat image = Imgcodecs.imread(path1);                                                                                        
   String path=this.getClass().getResource("/opencv/haarcascade_frontalface_alt.xml").getPath();                                                                                        
                     path=path.substring(1, path.length());                                                                                        
   CascadeClassifier faceDetector = new CascadeClassifier(path);                                                                                        
   MatOfRect faceDetections = new MatOfRect();                                                                                        
   faceDetector.detectMultiScale(image, faceDetections);                                                                                        
   System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));                                                                                        

it's run well on win10 tomcat8 jdk8,but when i publish it to windows server 2008 or 2012,always return opencv_java400.dll: Can't find dependent libraries,i tried 2 days to solve this question but failed,please help me!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2018-10-31 04:25:40 -0500

berak gravatar image

i don't think, we can really help you with tomcat problems (that's far beyond the scope of this page), but

Can't find dependent libraries

means, it is looking for other opencv dlls like opencv_core400.dll, opencv_imgproc400.dll, etc, and cannot find those

you probably forgot to install those dlls along with opencv_java400.dll

imho, you should try to rebuild the libs, using


so opencv_java_400.dll does not have any further dependancies

edit flag offensive delete link more


but why it can be used on win10?

bigzai gravatar imagebigzai ( 2018-10-31 20:45:32 -0500 )edit

it might also be windows internal dependancies here. the prebuilt opencv win packs are built on win10, using either vc14 or vc15, so, next attempt would be to install the resp. VC runtime for that on your server.

berak gravatar imageberak ( 2018-11-01 09:08:21 -0500 )edit

also have a look here, please !

berak gravatar imageberak ( 2018-11-01 14:43:44 -0500 )edit

answered 2020-09-17 08:51:08 -0500

Sneha gravatar image

You can also try placing this dll file inside your "JAVA_HOME/lib" path. I faced the same issue.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-31 04:07:17 -0500

Seen: 1,174 times

Last updated: Oct 31 '18