← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #264451]: issues with interfacing SikuliX jar with C++ using JNI

 

Question #264451 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/264451

    Status: Open => Answered

RaiMan proposed the following answer:
It depends on what you want to achieve:

-- use single API features in your C++ code
... by directly calling these methods (your JNI approach).

as mentioned: overkill in my opinion 
... and needs very good reasons to do that (I cannot see any though)

-- run short workflow snippets
... at specific points in your C++ code
For this I would suggest to use JavaScript scripts and run them in a subprocess using
java -jar sikulixapi.jar -r somescript.sikuli

where somescript.sikuli is a folder containing the needed images and a
somescript.js containing the workflow

Using JNI, you might use 
org.sikuli.script.Runner.run("path-to-somescript.sikuli", args-array)

the advantage: the startup delay is rather short compared to the Jython
scripts running.

If interested in this solution: come back and tell me more about your
usage scenario

-- with 1.1.0 final (available in one of the next nightlies)
... there will be a RunServer (specially started sikulixapi.jar) that waits for socket-based requests, which can be single API calls and/or complete script snippets to be run. The server can be on the same machine or somewhere in the TCP/IP network.
This is mainly implemented, to support any environments, that cannot integrate with Java directly (like C++, C# and others)

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.