jpype: Fail to use Screen.wait() function within jpype

Asked by Reed Xia

Hi, I'm trying to implement some test code with jpype(Python) and sikulixapi-2.0.5.jar, and get the problem below:

# content of

from jpype import *

JVM_PATH = r"C:\Program Files\Eclipse Adoptium\jdk-8.0.345.1-hotspot\jre\bin\server\jvm.dll"
SIKULIX_JAR_PATH = r"D:\my_jars\sikulixapi-2.0.5.jar"
BarPNG = "D:\\my_images\\nexusBar.png"

LongTimeout = float(60)

if __name__ == "__main__":
        startJVM(JVM_PATH, "-ea", "-Djava.class.path={}".format(SIKULIX_JAR_PATH))
        Screen = JClass("org.sikuli.script.Screen")
        screenHandler = Screen()
        screenHandler.wait(BarPNG, LongTimeout)
   except Exception as e:

it will throw exception when it runs into "screenHandler.wait(BarPNG, LongTimeout)", Python or JVM consider the wait() function is the one from java.lang.Object.wait, not the one from org.sikulix.script.Region

(venv39) PS D:\dev\jpype_sikulix>
(venv39) PS D:\dev\jpype_sikulix>
No matching overloads found for java.lang.Object.wait(str,float), options are:
        public final void java.lang.Object.wait() throws java.lang.InterruptedException
        public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
        public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException

Could someone help and know why? Thanks!

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Reed Xia (reedx) said :

I'm using Windows 10, and below JDK

openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Temurin)(build 25.345-b01, mixed mode)

Revision history for this message
Launchpad Janitor (janitor) said :

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
RaiMan (raimund-hocke) said :

Interesting: jpype.
Will have a look into it (might take some time)

Can you help with this problem?

Provide an answer of your own, or ask Reed Xia for more information if necessary.

To post a message you must log in.