Java Error: UnsatisfiedLinkError on Mac Eclipse

Asked by Min-cheng HUANG

Hello,

I am writing the simple Sikuli Test based on Java and Sikuli-Script API.

Code:
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Region;
import org.sikuli.script.Screen;

public static void main(String args[]) throws FindFailed{
 Region r = mew Region(1000,0,1000,1000);
 Pattern p = new Pattern("/File/Path/Here");
 r.exists(p);
}

The error message is below:
java.io.IOException: Unable to find library META-INF/lib/libVisionProxy.dylib on classpath
at com.wapmx.nativeutils.jniloader.DefaultJniExtractor.extractResource(DefaultJniExtractor.java:118)
at com.wapmx.nativeutils.jniloader.DefaultJniExtractor.extractJni(DefaultJniExtractor.java:101)
at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:43)
at org.sikuli.script.Finder.<clinit>(Finder.java:28)
at org.sikuli.script.Region.doFind(Region.java:769)
at org.sikuli.script.Region$RepeatableFind.run(Region.java:1160)
at org.sikuli.script.Region$Repeatable.repeat(Region.java:1131)
at org.sikuli.script.Region.exists(Region.java:439)
at org.sikuli.script.Region.exists(Region.java:428)
at SikuliTest.main(SikuliTest.java:10)
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.sikuli.script.natives.VisionProxyJNI.new_FindInput__SWIG_0()J
at org.sikuli.script.natives.VisionProxyJNI.new_FindInput__SWIG_0(Native Method)
at org.sikuli.script.natives.FindInput.<init>(FindInput.java:39)
at org.sikuli.script.Finder.<init>(Finder.java:21)
at org.sikuli.script.Region.doFind(Region.java:769)
at org.sikuli.script.Region$RepeatableFind.run(Region.java:1160)
at org.sikuli.script.Region$Repeatable.repeat(Region.java:1131)
at org.sikuli.script.Region.exists(Region.java:439)
at org.sikuli.script.Region.exists(Region.java:428)
at SikuliTest.main(SikuliTest.java:10)

The code works well on Windows. So, I am thinking it would be the configuration on mac machine. I did set the build path and import the sikuli-script.jar into the library. And, I put the Sikuli-IDE in the Application Folder. Jave version:1.6

Please advice. Any help is appreciated.

Question information

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

It looks like some mix of Sikuli stuff.

Where did you get the sikuli-script.jar from?

-- you say: and import the sikuli-script.jar into the library
only a reference to sikuli-script.jar (/Application/Sikuli-IDE/Contents/Resources/Java/sikuli-script.jar) is needed.
from the docs: http://sikuli.org/docx/faq/040-other-ide.html#eclipse (ignore Python stuff)
- reference to path-to/sikuli-script.jar
Mac: As with NetBeans, the file dialog does not allow to step inside Sikuli-IDE.app. So we use the trick, to define a String Substitution Variable: on the respective tab click Add variable, name it e.g. sikuli-script and enter as value: /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar. Go back to the tab External Libraries and click Add based on variable. In the entry field enter: ${sikuli-script} and click OK

Revision history for this message
Min-cheng HUANG (mhuang-a) said :
#2

Hello Raiman,

It works now. :)

Here is the step I did (most of them are the same as your step.):

1. Copy Sikuli-ide.app to Application
2. In eclipse (Helios service release 2), Configure Java build path -> add variable -> configure variables... -> new -> Name: sikuli-script / Path: /Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar -> ok -> ok

Really thanks a lot for your help :)

Revision history for this message
Vince (melekal) said :
#3

Thanks for posting what you did to get this to work Min-cheng. It fixed my issue as well.