-
Couldn't load subscription status.
- Fork 388
How to make and run Jython scripts packed in jars
Raimund Hocke edited this page May 19, 2020
·
3 revisions
The prerequisites:
- save the script to a
.sikuliscript folder - make sure it works and does not produce any syntax errors
Imports for additional private stuff:
- is currently under investigation and will be improved over time
- currently it has to be organised by putting folders (jars not finally tested) outside the jar on
sys.pathat runtime in your packed script. - having imported
.pyfiles also in the packed.sikulifolder should work
Handling of images
- is currently under investigation and will be improved over time
- currently you should either have all needed images in the packed
.sikulifolder or use the ImagePath feature to access images inside/outside the jar
Create the jar file
- open your script in the IDE
- in the menu
Fileuse the entryExport as runnable jar - wait for the OK-popup
- the jar is created as
your-scripts-name_sikuli.jarin the parent folder of your script - you can move it where ever you want
Currently both menu entries Export as jar and Export as runnable jar produce jars, that can be run by using
method 1: java -jar sikulix(ide/api)....jar -r somescript_sikuli.jar parameter
Only a jar produced with Export as runnable jar currently is self-runnable, which means can be used as
method 2: java -jar somescript_sikuli.jar parameter
Prerequisites for method 1
- the system must have a valid SikuliX installation of version 2.0.x+
Prerequisites for method 2 (only available in 2.0.5+)
- same as for method 1
- (only available in 2.0.5+) or a jar containing SikuliX and Jython packed together in the same folder as the runnable script jar named
sikulixjython.jar(seeCreate a sikulixjython.jar).
- this jar can be used as is on systems only having a valid Java installation
- Have a valid SikuliX installation with a
sikulixide....jarand ajython-standalone-2.7.1.jar - start the IDE and be sure that Jython scripts are running without problems
- in menu
Toolsuse the entryPack Jar with Jython - the creation of the jar will take a while (about 10 - 20 seconds), is reported in the status line at the bottom of the IDE (currently no progress indicator) and will end with a success/error popup
- the created jar
sikulixjython.jarwill be in the<appdata-folder>/SikulixStore
- both export concepts will be merged to one
Export to runnableincluding the.sklvariant - the detection of the environment will be improved
- the possibilities to support imports of scripts and images will be improved