Ask Your Question
0

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

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

bigzai gravatar image

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

berak gravatar image

java code:

   System.loadLibrary(Core.NATIVE_LIBRARY_NAME);                                                                                        
   Mat image = Imgcodecs.imread(path1);                                                                                        
   String path=this.getClass().getResource("/opencv/haarcascade_frontalface_alt.xml").getPath();                                                                                        
   if(path.startsWith("/")){                                                                                        
                     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));                                                                                        
   result=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
1

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

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

 cmake -DBUILD_SHARED_LIBS=OFF

so opencv_java_400.dll does not have any further dependancies

edit flag offensive delete link more

Comments

but why it can be used on win10?

bigzai gravatar imagebigzai ( 2018-10-31 20:45:32 -0600 )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 -0600 )edit

also have a look here, please !

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

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

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

Question Tools

1 follower

Stats

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

Seen: 2,470 times

Last updated: Oct 31 '18