[1.0] Works in Eclipse, but not from commandline using Ant build file to run it

Asked by srijith

So, I have configured Eclipse and Selenium Webdriver for my automation in Java. But for flast contents I have planned to use Sikuli with screenshots. so I have configured Webdriver and Sikuli JARs in Eclipse . It works perfect when I execute the java code with the play button or (Run) in eclipse GUI. The Sikuli is able to click on button, type etc.

Later I moved and configured Apache Ant to execute this code in command line. I wrote Build.xml and also included sikuli-script.jar in classpath in build.xml file. The xml file compiles and also Runs, But when the flash part comes, where the sikuli code begins , It is unable to work and does nothing, the execution stops throwing below error in command prompt.

     [java] [error] org.sikuli.script.FileManager.loadLibrary: Native library co
uld not be loaded: VisionProxy
     [java] [error] Since native library was found, it might be a problem with n
eeded dependent libraries
     [java] java.lang.UnsatisfiedLinkError: G:\Documents and Settings\Administra
tor\eworkspace\Sample\SikuliX\libs\VisionProxy.dll: Can't find dependent librari
es
.... more stack trace

Can someone help me on this ? I remember I got the same error
 java.lang.UnsatisfiedLinkError: G:\Documents and Settings\Administra
tor\eworkspace\Sample\SikuliX\libs\VisionProxy.dll: Can't find dependent librari
es

when configuring SIkuli in Eclipse GUI and I resolved it by getting the 64-bit version of JRE and Sikuli. Now how can it come back ? Please help, I'm using windows server 2003 64-bit (x86)

Thank you

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
RaiMan Edit question
Solved by:
srijith
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

What java version do you use when running Ant?
pls. be as accuarate as possible.

What is your system path when running Ant?
What is your system path in the moment, the jvm is started in the build.xml to run your artifact?

Revision history for this message
srijith (srijithbhandary) said :
#2

This is my Java version output
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

I execute the ant command in my project work space.
ie run the ant command here
G:\Documents and Settings\Administrator\eworkspace\Sample>
where Sample in my project name.
Here is my system path for ant and sikuli JAR file
G:\Program Files (x86)\apache-ant-1.9.1\bin;G:\eclipse\sikuli-script.jar;

Here is my build.xml file
<?xml version="1.0" encoding="UTF-8"?>

<project default="run" name="DMM Automation -srijith">
<path id="classpath">
<pathelement location="G:\eclipse\selenium-2.33.0\selenium-java-2.33.0.jar"/>
<pathelement location="G:\eclipse\selenium-server-standalone-2.33.0.jar"/>
<pathelement location="G:\eclipse\selenium-2.33.0\selenium-java-2.33.0-srcs.jar"/>
<pathelement location="G:\eclipse\selenium-2.33.0\libs\*.jar"/>
<pathelement location="G:\eclipse\sikuli-script.jar"/>
<pathelement location="G:\Program Files (x86)\SikuliX\*.jar"/>
</path>

 <target name="run" depends="compile">
 <java classname ="lib_files.Open" classpathref="classpath">

 <classpath path="staging"/>

 </java>
 </target>
 <target name="compile">
 <javac includeantruntime="false" srcdir="./src" destdir="staging" classpathref="classpath"/>
 </target>
</project>

Not sure if these are the information you are looking for

Revision history for this message
RaiMan (raimund-hocke) said :
#3

-- 1. system path: G:\Program Files (x86)\apache-ant-1.9.1\bin;G:\eclipse\sikuli-script.jar;
to have G:\eclipse\sikuli-script.jar in the system path does not make any sense. No executables to load from there.

--2. why is sikuli-script.jar in G:\eclipse\ ?
You should work with references and not with copies! In your eclipse project properties you can set up a ref to G:\Program Files (x86)\SikuliX\sikuli-script.jar
Copying Sikuli stuff around is a big risk for future big problems.

--3. G:\Documents and Settings\Administrator\eworkspace\Sample\SikuliX\libs\
furthermore you seem to copy around the Sikuli libs folder. leave it in place at G:\Program Files (x86)\SikuliX\ and add in your global Windows environment settings to the system path: G:\Program Files (x86)\SikuliX\libs
So you have it one for all.

If you have all this, then the last thing to do is to specify in the global Windows environment settings:
SIKULI_HOME=G:\Program Files (x86)\SikuliX\
trailing slash mandatory with Sikuli X-1.0rc3
This allows Sikuli to know, where the installation is.

Again as a general recommendation: leave the Sikuli stuff in one place and work with references!

Revision history for this message
srijith (srijithbhandary) said :
#4

Thanks for the tips...It helped a lot...
I removed all the copies and provided references to eclipse and added the SIKULI_HOME path and it worked.