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 my_test.py

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__":
    try:
        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:
        print(e)
        shutdownJVM()

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

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Reed Xia (reedx) said :
#1

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 :
#2

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 :
#3

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.