UnsatisfiedLinkError when i use click Methode of Sikuli on java (Windows)

Asked by emrah kara

i want to use click methode on java. but it never works. i tried it with many other screenshots and variations but still get the error below.

private void click() throws FindFailed{
  screen.click("imgs/desktop.png");
 }

this is a screenshot to show where my sikuli-jar and the desktrop.png are saved.
http://www.myimg.de/?img=UnsatisfiedLinkError6e759.jpg

my desktop.png
http://www.myimg.de/?img=desktopjpg85e94.png

and the error that i get :(

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Dokumente und Einstellungen\ekc\Lokale Einstellungen\Temp\tmplib\VisionProxy.dll: Can't find dependent libraries
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(Unknown Source)
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.load0(Unknown Source)
 at java.lang.System.load(Unknown Source)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:44)
 at org.sikuli.script.Finder.<clinit>(Finder.java:33)
 at org.sikuli.script.Region.doFind(Region.java:1029)
 at org.sikuli.script.Region$RepeatableFind.run(Region.java:1232)
 at org.sikuli.script.Region$Repeatable.repeat(Region.java:1203)
 at org.sikuli.script.Region.wait(Region.java:497)
 at org.sikuli.script.Region.find(Region.java:381)
 at org.sikuli.script.Region.getLocationFromPSRML(Region.java:1129)
 at org.sikuli.script.Region.click(Region.java:606)
 at org.sikuli.script.Region.click(Region.java:593)
 at ScotiaStarten.click(ScotiaStarten.java:92)
 at ScotiaStarten.main(ScotiaStarten.java:102)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:

This question was reopened

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

as stated in the docs:
You need a full functioning standard installation of Sikuli.

Revision history for this message
emrah kara (emrah-karakoc) said :
#2

i checked it many times. but i dont have any environment variable that is %SIKULI_HOME% ..
should i make it by myself?
http://www.myimg.de/?img=environmentvariable378e3.jpg

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

again:
- Sikuli should be installed in
C:\Program Files\Sikuli X

- make sure, that in the Eclipse/Java environment when running your java program these to entries are in system path:
C:\Program Files\Sikuli X\libs\
C:\Program Files\java\jre6\bin

- %SIKULI_HOME%
should be set to
C:\Program Files\Sikuli X\
trailing \ mandatory!

--- and again:
do not have a copy of sikuli-script.jar in your Eclipse project, use a reference to the installation directory with your project settings.

Revision history for this message
emrah kara (emrah-karakoc) said :
#4

Thanks RaiMan, that solved my question.

Revision history for this message
emrah kara (emrah-karakoc) said :
#5

I did everything what you said. Thanks alot

How i can let Sikuli on java to click on a place, that i have a screenshot from ?

it only works if i let Sikuli do screen.capture() or screen.click(Region).

But i cant use screen.click("Path-to-an-Image") or screen.click(match.find("Path-to-an-image"));

if i write this code, i get the same errors above:
Match m = s.find("fotosToGet/Unbenannt3.jpg");
s.click(m);

if i write this code, it happens nothing:
BufferedImage bim = ImageIO.read(new File("fotosToGet/Unbenannt2.jpg"));
s.click(bim);

but click works with coordinations great.

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

I am not sure, but Sikuli needs .png files.

Revision history for this message
emrah kara (emrah-karakoc) said :
#7

Still doesnt work =((

even screen.click("fotosToGet/Unbenannt2.png"); doesnt work :(

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

Sorry, that was too fast ;-)

--- if i write this code, i get the same errors above: Match m = s.find("fotosToGet/Unbenannt3.jpg");

With error do you mean:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Dokumente und Einstellungen\ekc\Lokale Einstellungen\Temp\tmplib\VisionProxy.dll: Can't find dependent libraries

If yes, then your installation still is not correct.

Make sure, that inside Eclipse the env variable SIKULI_HOME is defined correctly and useable.

Revision history for this message
emrah kara (emrah-karakoc) said :
#9

Yes the error which you mentioned. I did it really many times.. again and again.. How can it be that i use any other functions of Sikuli but not the ones with click :(

Revision history for this message
emrah kara (emrah-karakoc) said :
#10
Revision history for this message
Best RaiMan (raimund-hocke) said :
#11

Wer lesen kann ist im Vorteil ;-)

- %SIKULI_HOME%
should be set to
C:\Program Files\Sikuli X\
trailing \ mandatory!

Revision history for this message
emrah kara (emrah-karakoc) said :
#12

Thanks RaiMan, that solved my question.

Revision history for this message
Filipe Alonso (filipe-alonso) said :
#13

 1. You must use a 32bit JRE version (I use jre-7u4-windows-i586.exe)
 2. Download Sikuli IDE for Windows (I use "Sikuli X r930", portable version)
 3. Unpack it and copy files to your project folder (I renamed it to "sikuli-ide", check image http://i.stack.imgur.com/LSiQV.png)
 4. Add sikuli-script.jar to the Referenced Libraries (Project > Properties > Java Build Path > Libraries, check image http://i.stack.imgur.com/N2SJ8.png)
 5. Set PATH and SIKULI_HOME environment vars (Run > Run Configurations > Environment, check image http://i.stack.imgur.com/HboXk.png)
 6. You're ready to go ;)

Revision history for this message
emrah kara (emrah-karakoc) said :
#14

Thanks Alonso :)

Revision history for this message
emrah kara (emrah-karakoc) said :
#15

It still doesnt work. i dont know why. i am getting the same error what i wrote at the beginning..
i did "C:\Program Files\Sikuli X\" like RaiMan said..
i did everything what you said Felippe but it doesn't still work :(

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

Just make the following test in your main Java app from inside Eclipse:

System.out.println(System.getenv("PATH"));

and paste what you have.

Revision history for this message
emrah kara (emrah-karakoc) said :
#17

C:\Programme\Java\jre6\bin\client;C:\Programme\Java\jre6\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\Intel\DMIX;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Programme\Gemeinsame Dateien\Roxio Shared\DLLShared

Revision history for this message
Filipe Alonso (filipe-alonso) said :
#18

@emrah

When you set your PATH and SIKULI_HOME on Run Configurations (Eclipse) you must check the "Replace native environment ..." radiobox.

Regarding the PATH, for example, in my case i've set it to "${workspace_loc:/SikuliProject/sikuli-ide/libs}" which means

${workspace_loc} --> absolute path to your Eclipse workspace
/SikuliProject ----> Name of your Eclipse Project
/sikuli-ide/libs ----> folder you previously imported (copy) into your project folder

Make sure you've set your own PATH according to your own project and parameters.

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

@ emrah
In your PATH
c:\Programme\Sikuli X\libs
is missing.

So depending on your Eclipse setup Filipe's suggestion might help.

@ Filipe
I would never recommend to COPY the Sikuli stuff into your workplace folder or even a project.
You should always work with references to the original standard install places.

Revision history for this message
Filipe Alonso (filipe-alonso) said :
#20

@RaiMan

I agree, the solution i provide is just the fastest for test running a java project without changing your system and without the need to install Sikuli X.

For application deployment one should certainly change this according to requirements.

@emrah kara

If you want to deploy a runnable application (eg. runnable jar or so) you should consider RaiMan's suggestion. If you're just for test and source development then you only need to follow my suggestion.

As you can notice, and RaiMan already stated, your PATH does not include the path for sikuli x\libs folder... make sure to either add it manually in System's Environmental variables, or set it in Eclipse as i mentioned in point 5) for running purposes.

And don't forget to set SIKULI_HOME as well.