How to Get OpenCV 4.0.1 Working With Katalon (Windows) On Native Library (i.e., DLL) Together JAR


#1

May I know how to get Katalon to work with opencv-401.jar as got the native library loaded that in turn loaded opencv_java401.dll for Windows platform?

Got the following exception when performing Imgcodecs.imread(), any idea how to solve it?

FYI, same platform similar code has no issue executed from Eclipse.

@Vinh_Nguyen do you have any recommendation?
Initially on Katalon 5.10.1, later tested and setup with Eclipse like build setup on version 6.0.6, still the same issue.

Such are working the same like Eclipse IDE of similar Java codes, but not when calling “Imgcodecs.imread()”:

KeywordUtil.logInfo("Welcome to OpenCV hhhh " + Core.VERSION);
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );

Also, tried such loading as well, the same outcome as above:

System.loadLibrary( “opencv_java401” );

> 2019-03-08 14:18:21.882 e[1;31mERRORe[0;39m e[36mk.k.c.m.CustomKeywordDelegatingMetaClass -e[0;39m e[31m❌ java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)Je[0;39m
> 2019-03-08 14:18:21.894 e[1;31mERRORe[0;39m e[36mc.k.katalon.core.main.TestCaseExecutor -e[0;39m e[31m❌ if (utlPkg.AT.crackImages(g_ScrSnapDir, “Please wait”)) FAILED.e[0;39m
> e[31mReason:e[0;39m
**> e[31morg.codehaus.groovy.runtime.InvokerInvocationException: **java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)Je[0;39m
> e[31m at utlPkg.AT.invokeMethod(AT.groovy)e[0;39m
> e[31m at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:49)e[0;39m
> e[31m at UT OCR.run(UT OCR:31)e[0;39m
> e[31m at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)e[0;39m
> e[31m at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:328)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:319)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:298)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:290)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:224)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:106)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:97)e[0;39m
> e[31m at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)e[0;39m
> e[31m at TempTestCase1552025897186.run(TempTestCase1552025897186.groovy:22)e[0;39m
> e[31mCaused by: java.lang.UnsatisfiedLinkError: org.opencv.imgcodecs.Imgcodecs.imread_1(Ljava/lang/String;)Je[0;39m
> e[31m at org.opencv.imgcodecs.Imgcodecs.imread_1(Native Method)e[0;39m
> e[31m at org.opencv.imgcodecs.Imgcodecs.imread(Imgcodecs.java:112)e[0;39m
> e[31m at org.opencv.imgcodecs.Imgcodecs$imread.call(Unknown Source)e[0;39m
> e[31m at utlPkg.AT.crackImage(AT.groovy:163)e[0;39m
> e[31m at utlPkg.AT.crackImages(AT.groovy:208)e[0;39m
> e[31m at utlPkg.AT.invokeMethod(AT.groovy)e[0;39m
> e[31m at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:49)e[0;39m
> e[31m at Script1551188225753.run(Script1551188225753.groovy:31)e[0;39m
> e[31m … 11 more