[2.0.4] macOS: using sikulixapi by jpype --- currently not possible

Asked by Yang on 2020-12-15

**************** tracked on GitHub: https://github.com/RaiMan/SikuliX1/issues/400

I tried to use Jpype1 (https://pypi.org/project/JPype1/) to automate GUI with 'sikulixapi.jar' on macOS.
This package works well when I imported it on my java project, but had problem when I used Jpype1 to access it.

Here is my code:
`from jpype import *

startJVM(get_default_jvm_path(), '-ea', r'-Djava.class.path=somepath/sikulixapi.jar')
Screen = JClass('org.sikuli.script.Screen')
s = Screen()
When the code ran into 'Screen = JClass('org.sikuli.script.Screen')', my program was in deadlock. Not any responses unless ending the python process.

I'm looking forward to your suggestions,thanks.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

Which SikuliX?
Which Java?

I will make some tests the next days on macOS 11, Java 11 (AdoptOpenJDK) and SikuliX 2.0.4 and report here.

Yang (bluceyang) said : #2

my java version is "1.8.0_251"
and sikulixapi-2.0.4

RaiMan (raimund-hocke) said : #3

tracked on GitHub

RaiMan (raimund-hocke) said : #4

my tests showed, that it does not work.

Yang (bluceyang) said : #5

thanks for your help , maybe I will try other ways to use it