Error while calling the custom keyword which has been created by using sikuliXapi in the Katalon studio

imports:
import org.sikuli.script.*
import com.kms.katalon.core.util.KeywordUtil

custom keyword:

@Keyword
def dragDropByImage(String s1,String s2){

	Screen s = new Screen()

	String path = new File('.').getCanonicalPath()
	
	String imgPath1=path+s1
	String imgPath2=path+s2
	
	Pattern pt1 = new Pattern(imgPath1)
	Pattern pt2 = new Pattern(imgPath2)

	if (pt1 == null || pt2==null) {
		throw new FindFailed('image not found')
	} else {
		s.dragDrop(pt1, pt2)
		KeywordUtil.markPassed("image clicked successfully")
	}
}

This keyword was working on the previous version of the Katalon studio which was 8.4 but since I updated it to the version 8.5.1, it is showing the below error. please suggest a solution for this!

this is the script step i have used:

CustomKeywords.‘com.keywords.dragDropByImage’(“//Screenshots//Targets//Thematic Map//Scroll key press USA.png”,“//Screenshots//Targets//Thematic Map//south africa drop.png”)

When I try to run the script by using this custom keyword it is showing the following error:
java.lang.NoSuchMethodError: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library;

Hey @amargaikwad, welcome to our Katalon Community.

Currently, Katalon Studio uses jna-4.1.0 and jna-platform-4.1.0 as dependencies for Katalon’s projects. If you want to update with newer versions, you can find and replace them at folder:

KS_folder/configuration/resources/lib

I found this article helpful for your problem How to Fix java.lang.NoSuchMethodError in Java | Rollbar.

Hope this helps!

Yeah…It worked! Thanks. I have updated the jna and jna-platform jar files to latest version.

1 Like