[request] want a real standalone sikuli-script.jar

Bug #696822 reported by RaiMan on 2011-01-03
This bug affects 4 people
Affects Status Importance Assigned to Milestone

Bug Description

scope: Sikuli X on all platforms.

--- Request:
Available with the downloadable package I want to have a fully self contained sikuli-script-standalone.jar. No fiddling around with dynamic link libraries and system path's. It should just be sufficient to have it in the java class path and if needed in the python path (sys.path, the need to say sikuli-script-standalone.jar/Lib is acceptable). from sikuli.Sikuli import * should then be all I have to do.
Possible Solution: pack ALL needed native libraries in the jar file and copy them as needed at runtime into the appropriate temp folder so they can find themselves automatically. It should be one .jar for all platforms to be able to pack it together with the scripts.

--- Current Situation:
When you decide (based on whatever reasons) to not use the Sikuli IDE to edit, run and debug your scripts, you only need two resources from the package you download from Sikuli home:
- the folder that contains the native libraries (openCV (has to be installed seperately on Linux) and some system specifics)
- sikuli-script.jar

With some practical differences on the platforms you have to take care:
- that Sikuli finds the native libraries (mainly using path specifications in system path)
- to have sikuli-script.jar in the java class path
- to have sikuli-script.jar/Lib in the Python path (sys.path)
- to say "from sikuli.Sikuli import * " in your main module and all imported modules using Sikuli features
- preserve the .sikuli/.skl folder structure if you want to use the new import/imagePath feature

(I know, that there are currently problems with 64-Bit environments, but this has nothing to do with this principal approach)

This is all you need for the Python level.
If you want to use Sikuli features on the Java level, it is principally the same (but no need for Python path, Sikuli features are imported using org.sikuli.script.*)

Having this prepared you can use IDE's like NetBeans or Eclipse (you might need plugins for Python) to edit, run and debug your scripts and run your scripts using plain Jython or Java.

With the new features of Sikuli X it is now possible to manage your image libraries and some related scripts with Sikuli IDE, but completely using e.g. NetBeans to do the programming (edit, run, debug, ...) of your workflows and/or test suites.

--- Current technical solution regarding the dynamic libraries:
When the initialization logic in sikuli-script.jar (triggered with the first import sikuli.Sikuli) realizes, that it is not running in the IDE context, it copies some proxy dynamic libraries contained in sikuli-script.jar to a temp directory, that in turn will try to find the other above mentioned native libraries. this location is maintained in the java system property java.library.tmpdir and can be set by the script before the first import of Sikuli features.

On Windows currently it is sufficient to add the following to the system path:

On Linux it should be similar

On Mac you have to manipulate the jnilib's and dylib's to contain the correct pointers to each other, depending on the location of the libraries (if interested contact me directly). the most flexible way is to use the directive @loader_path.

--- Specifying sikuli-script.jar/Lib in IDE's
in some IDE/platform combinations it is not possible to specify this in the settings panels.
Then you have the following choices:
- in your main script modify sys.path before the first import of Sikuli features
- edit the relevant configuration file by hand: (Netbeans: User folder .netbeans/build.properties, Eclipse: I do not know ;-)

RaiMan (raimund-hocke) on 2011-01-09
Changed in sikuli:
status: New → Fix Committed
milestone: none → x1.0-rc2
RaiMan (raimund-hocke) on 2011-01-12
summary: - [feature request] want a real standalone sikuli-script.jar
+ [request] want a real standalone sikuli-script.jar
surfdork (surfdork) wrote :

The current instructions are inadequate.

This is a significant issue that is blocking use of Sikuli,

I still can't get scripts to execute

My project will be terminated this Friday unless I can get my previously working Sikuli scripts to work from within NetBeans.

One error leads to another, I can no longer import subprocess even in the Sikuli IDE, this breaks most of my scripts.

RaiMan (raimund-hocke) wrote :

What is happening?

What is your configuration?

I have it running with Netbeans or plain Jython or plain java only using sikuli-script.jar and the native libs that come with the distribution on Mac OS X 10.6 and Windows 7.

RaiMan (raimund-hocke) on 2011-01-19
Changed in sikuli:
importance: Undecided → Wishlist
Powers Foss (powers-foss) wrote :

Hi RaiMan,

I see this request has a "Fix Committed" status. Does that mean it'll make it into X1.0 rc3? I would love to be able to drop in Sikuli from my Java code. I'm going to try to get it working using the steps you noted above on my Mac OS 10.6 system. My current test automation framework is Java/Selenium 2.0/WebDriver, but I find Sikuli very promising and would love to incorporate its functionality. Any estimates on when either the next release candidate or final 1.0 release might be delivered? Thanks for all the good work!


Powers Foss (powers-foss) wrote :

Oh, I meant to say, "Does that mean it'll make it into X1.0 rc2?" I see now that rc2 is slated for 1/30/2011. Hoping it can all be a standalone jar. Even though I went through all 3 steps listed here http://<email address hidden>/msg00592.html I am still getting the unsatisfied link error:

java.lang.UnsatisfiedLinkError: /Applications/Sikuli-IDE.app/Frameworks/libVisionProxy.jnilib: Library not loaded: libcxcore.2.1.dylib Referenced from: /Applications/Sikuli-IDE.app/Frameworks/libVisionProxy.jnilib Reason: image not found

If this is all you had to do to get it working on OS X 10.6 then I will download a fresh copy of X1.0 RC1 and try again. If that doesn't work, I'm hoping it'll work out-of-the-box in RC2. Fingers crossed!

Powers Foss (powers-foss) wrote :

Okay, I got it working. It was my mistake. Using only the 3 steps mentioned here http://<email address hidden>/msg00592.html it works fine with Sikuli X 1.0 rc1 on OS X 10.6. Yay!

RaiMan (raimund-hocke) wrote :

Yes I know, that it will work with X 1.0 rc2 out of the box. Only preliminary will be, that Sikuli-IDE.app is in /Applications.

When rc2 is out, I will document the options in FAQ 1436.

tritethunder (tritethunder) wrote :

I am getting this error do I miss something I am trying to run the same code using eclipse in mac

Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/var/folders/wy/wyvPPgiAHJejdjvgw8ZiE++++TI/-Tmp-/tmplib/libVisionProxy.jnilib: Library not loaded: libcxcore.2.1.dylib Referenced from: /private/var/folders/wy/wyvPPgiAHJejdjvgw8ZiE++++TI/-Tmp-/tmplib/libVisionProxy.jnilib Reason: image not found
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
 at java.lang.Runtime.load0(Runtime.java:770)
 at java.lang.System.load(System.java:1020)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
 at org.sikuli.script.Finder.<clinit>(Finder.java:20)
 at org.sikuli.script.Region.findNow(Region.java:589)
 at org.sikuli.script.Region.wait(Region.java:277)
 at org.sikuli.script.Region.find(Region.java:235)
 at org.sikuli.script.Region.getLocationFromPSRML(Region.java:652)
 at org.sikuli.script.Region.click(Region.java:346)
 at org.spotify.playsong.sikuli.main(sikuli.java:12)

RaiMan (raimund-hocke) wrote :

on Mac, the situation with X 1.0rc1 is a bit more complex with the native libraries like libVisionProxy.jnilib.

Either wait for X 1.0rc2, where the problem will be solved, or send me a mail to https://launchpad.net/~raimund-hocke, I can tell you a solution.

RaiMan (raimund-hocke) on 2011-02-21
Changed in sikuli:
status: Fix Committed → Fix Released
janet (jed-pculture) wrote :

Since rc-2 was released, I've been meaning to write a quick comment and express my appreciation of all the work you have done on Sikuli-X.

This feature in particular is hugely helpful to me. Today, trying to figure out how I could create a subset test suite, picking and choosing unittests from my various .sikuli suites, I found I can use this command.

java -jar $SIKULI_HOME/sikuli-script.jar sg2_search.sikuli Miro_Suite.test_82

Also - I've started working to get my scripts to run on linux as well. Just needed to make a few minor tweaks and have found it to be rocket fast.

So awesomely simple. So Thanks, thank you and Thanks! to everyone on your team.

I m using Mac OS X 10.8.2 (12C2034) and Sikuli version x-1.0rc2 and using java version "1.6.0_37".But I m getting the error while running the sikuli script in eclipse.
"/private/var/folders/p8/_86_gq1x6pn2j0bl0p0xtkmh0000gp/T/tmplib/libVisionProxy.jnilib: Library not loaded: /usr/local/lib/libopencv_core.2.2.dylib Referenced from: /private/var/folders/p8/_86_gq1x6pn2j0bl0p0xtkmh0000gp/T/tmplib/libVisionProxy.jnilib Reason: image not found"

Please help me to resolve this problem...

RaiMan (raimund-hocke) wrote :

When asking questions in comments to other questions, you should subscribe to the question, to get notified about comments to your comment.

- upgrade to X-1.0rc3 (http://www.sikuli.org/download.html)

- look faq 1436

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers