App.open() and subprocess.Popen don't open a jar file on Mac OS (Sikuli version 2.0.0)

Asked by Aleks Kozaev

Hello!

I am trying to open a jar on Mac OS (Sikuli IDE version 2.0.0). I have tried 4 methods.

1) App.open(path_to_jar)
2) App(path_to_jar).open()
3) subprocess.Popen("java -jar "+path_to_jar)
4) subprocess.Popen(["java", "-jar", path_to_jar])

All of them work on windows perfectly but on Mac none of them work. Third throws an error and others do nothing (no error, no output, jar doesn't open). I have read here https://bugs.launchpad.net/sikuli/+bug/1717461 that adding "import subprocess" to Sikuli.py helps to make 4th method work, however, I couldn't reproduce it. After running Sikuli IDE, the SIkuli.py gets modified to it's previous state, so it does nothing. Do I have to create a new build of SIkuli somehow to make it work? If so, the how do I do it?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

does

java -jar your.jar

work from commandline?

Revision history for this message
Aleks Kozaev (aleksboyyy) said :
#2

Yes, this works from commandline (both on windows and mac)

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

this worked for me:
import subprocess as Sub
Sub.Popen(("java", "-jar", "/Users/raimundhocke/IdeaProjects/SikuliX/API/target/sikulixapi-2.1.0-SNAPSHOT-complete.jar"))

... and is currently the only way on Mac, to start something, that is not a macOS application (some.app)

Revision history for this message
Aleks Kozaev (aleksboyyy) said :
#4

Thank you for quick replies. This worked for me too. Seems that I typed the path wrong, hence nothing happened at first.

Revision history for this message
Aleks Kozaev (aleksboyyy) said :
#5

Thanks RaiMan, that solved my question.