JAR or EXE file from Sikuli python script

Asked by Max on 2017-11-01

I just started doing some scripts with Sikuli in python.

I would like to know if it's possible (and if yes, how) to create a jar or exe file from my python script (file .py and images).

I would like to easily run my program from other machines that do not have sikuli install (e.g., java -jar my_script.jar or my_script.exe) or give the utility to some colleagues, but I don't want that they see the source code.

I tried to follow this link but did not work -> https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts

Thank you for your help!!!

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2017-11-01
Last query:
2017-11-01
Last reply:
2017-11-01

This question was reopened

  • 2017-11-01 by Max
arminius (arminius75) said : #1

I've been able to run SKL files with a BAT file, but I don't know if Sikuli needs to be installed for that to work, someone with more experience should be along soon.

TestMechanic (ndinev) said : #2

You need Sikuli to be installed on the target machine
However if you done this on let say window, you will be able to copy and use it on another windows. Also you need to know that Sikuli support console installation. So you can achieve your goal with help of some scripting

Max (max883) said : #3

Thanks for the answers!

Is there a "standalone" sikuli jar or exe to execute sikuli scripts? I mean, I think I cannot install any software in other machines but I can download like a jar package or exe.

Sorry for the question but I'm completely new with Sikuli.

RaiMan (raimund-hocke) said : #4

If you can download jars. then download the setup.jar and run it to get a sikulix.jar, which besides Java is the jar needed to run your scripts on other machines.
http://sikulix.com

You might pack all needed stuff including your script, sikulix.jar and a run script into a self-extracting zip/exe for distribution to other machines.

Max (max883) said : #5

What if I write my code in java and I include all the classes like this:

import org.sikuli.script.*;

public class TestSikuli {

        public static void main(String[] args) {
                Screen s = new Screen();
                try{
                        s.click("imgs/spotlight.png", 0);
                }
                catch(FindFailed e){
                        e.printStackTrace();
                }

        }

}

Then I create a jar package. Also in that case I need to use sikulix.jar to run my jar? In answer #4, the thing I want to bypass (if possible) is to run the setup.jar in each pc. I wanted to use a standalone solution that does not require any setup.

Best RaiMan (raimund-hocke) said : #6

If you decide to program your workflows in Java, then only sikulixapi.jar is needed.

Of course you can create a fat jar including sikulixapi.jar, but that is very inefficient (size and update challenge).

A more efficient solution is, to distribute a sikulixapi.jar once to every machine (created with setup) and then run your workflow jar from a run-script, that takes care, that the sikulixapi.jar is on the Java class path at runtime.

Max (max883) said : #7

Thanks RaiMan, that solved my question.

Max (max883) said : #8

Just a clarification to fully understand.

When you said "Of course you can create a fat jar including sikulixapi.jar", so in that case I create the big package using the sikulixapi.jar in my system + my java code, then I can distribute and run this big java package to any pc without running the setup on those systems, right?

Thank you again!!!

RaiMan (raimund-hocke) said : #9

Exactly so ;-)

Max (max883) said : #10

Thanks RaiMan, that solved my question.