How to create executable (.exe) file for any platform using Sikuli-script + Java + Eclips IDE

StackOverflow https://stackoverflow.com/questions/21621000

  •  08-10-2022
  •  | 
  •  

Question

I have create java application using sikuli-script(latest version 1.0.1).

I added the sikuli-script.jar to the Referenced Libraries (I configured using this answer Answer Link)

java code folder structure --> enter image description here

Java code -->

package com.example.sikuli;

import org.sikuli.script.*;
import java.util.concurrent.TimeUnit;    

public class TestSikuli {

    public static void main(String[] args) {
            Screen s = new Screen();
            App app = new App("C:/Program Files/Mozilla Firefox/firefox.exe");//firefox path
            try{
                    app.focus();
                    TimeUnit.SECONDS.sleep(2);
                    s.click("imgs/1391152193781.png", 0);//url bar image   
                    s.type(null, "http://www.google.lk", 0);  
                    s.click("imgs/1391152289812.png", 0);//click search image
            }
            catch(FindFailed e){
                    e.printStackTrace();
            }
    }

}

After that i set the the Run Configutrtion such as PATH and SIKULI_HOME enter image description here

Next I run the code it's working properly.

Then I create .exe using launch4j and according to this site instructions --> How to Create an Executable File from Eclipse

After that i run the .exe file from command prompt then following errors occurred. Please help me.

Error -->

[error] ResourceLoaderBasic: check: libs dir is empty, has wrong content or is outdated

[action] ResourceLoaderBasic: check: Please wait! Trying to extract libs to: C:\Documents and Settings\Dell\SikuliX\libs

[error] ResourceLoaderBasic: loadLib: Fatal Error 109: not found: C:\Documents and Settings\Dell\SikuliX\libs\VisionProxy.dll

[error] Terminating SikuliX after a fatal error(109)! Sorry, but it makes no sense to continue!

If you do not have any idea about the error cause or solution, run againwith a Debug level of 3. You might paste the output to the Q&A board.
Was it helpful?

Solution

--1. when programming in Java using Sikuli, you should always use sikuli-java.jar (sikuli-ide.jar contains much stuff not needed here).

--2. Set a JVM option -Dsikuli.Debug=3 when running the exe to get more details about what's going on. I guess the problem is, that for some reason the export of the native libs does not work in the context of a launch4J exe (I did not test this yet).

--3. always use the latest version (1.1.1 in this case, still nightly but pre-final ;-) http://sikulix.com

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top