X 1.0rc1 sikuli-script.jar not working on Linux Ubuntu 10.04 64bit

Bug #694771 reported by Nash
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Undecided
Unassigned

Bug Description

I need your help to figure-out if 'sikuli-script.jar' from 'Sikuli X 1.0 RC1' package is supported for Java programs running on Linux 64bit?

What is that I'm attempting?
Use Sikuli-X script within Java program (JVM 1.6).

What's the problem?
The problem I'm facing is the below mentioned Error dump. This error occurs when executing a simple Java program which attempts to call 'Screen.find("image.png")'.

What's working?
The good news is "./sikuli-ide.sh" works on my Linux Ubuntu 10.04 64bit. Hence, I can only execute sikuli scripts on my linux desktop from sikuli-ide.

-------------------------------------------------------------------
Error dump produced when run the java code with Eclipse-IDE(Helios)
-------------------------------------------------------------------
Exception in thread "main" java.lang.ExceptionInInitializerError
 at edu.mit.csail.uid.Region.findNow(Region.java:554)
 at edu.mit.csail.uid.Region.wait(Region.java:257)
 at edu.mit.csail.uid.Region.find(Region.java:215)
 at SikX_Test101.main(SikX_Test101.java:11)
Caused by: java.lang.NullPointerException
 at com.wapmx.nativeutils.jniloader.DefaultJniExtractor.extractResource(DefaultJniExtractor.java:113)
 at com.wapmx.nativeutils.jniloader.DefaultJniExtractor.extractJni(DefaultJniExtractor.java:98)
 at com.wapmx.nativeutils.jniloader.NativeLoader.loadLibrary(NativeLoader.java:43)
 at edu.mit.csail.uid.Finder.<clinit>(Finder.java:20)
 ... 4 more

------------------------
Java code being executed
------------------------
import edu.mit.csail.uid.*;

public class SikX_Test101 {

 public static void main(String[] args) {

  Screen s = new Screen();

  try {

   s.find("imgs/test.png");

  } catch (FindFailed e) {
   e.printStackTrace();
  }
 }
}

-------------------------------------------------------------
Software & Libraries that are installed on Ubuntu 10.04 64Bit
-------------------------------------------------------------
- Sikuli-X-1.0rc1-linux-x86_64.zip (For 64bit Linux)
- OpenCV 2.1 on Ubuntu 10.04 (http://tutorial.downloadatoz.com/how-to-install-opencv-2-1-on-ubuntu-10-04.html), which includes the following libraries on my Ubuntu:
 build-essential
 libgtk2.0-dev
 libavcodec-dev
 libavformat-dev
 libjpeg62-dev
 libtiff4-dev
 cmake
 libswscale-dev
 libjasper-dev

------------------
System Information
------------------
Platform: Ubuntu 10.04 64Bit
Processor: AMD Sempron 2800+
Java version:
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Nash (knshetty-live)
description: updated
summary: Java NullPointerException when using Sikuli-X-1.0-RC1's 'sikuli-
- script.jar' with Java program on Linux Ubuntu 10.04 64bit?
+ script.jar' with Java program on Linux Ubuntu 10.04 64bit
Nash (knshetty-live)
tags: added: jvm1.6
removed: 1.6 jvm
tags: added: ubuntu10.04
removed: 10.04 ubuntu
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: Java NullPointerException when using Sikuli-X-1.0-RC1's 'sikuli-script.jar' with Java program on Linux Ubuntu 10.04 64bit

When using sikuli-script.jar standalone, at initialization, they now copy dyn-lib's to the java.io.tmpdir (system-property). The error occurs exactly at this point.

I just looked at the code and into the Sikuli X linux 64 zip:
They are looking for .jnilib or .dylib, but in sikuli.script.jar/META-INF/lib you only find .so files. Could be the source of the error.

Try to use an un-jar-ed version of sikuli-script.jar and rename the .so to .dylib (which I think is acceptable on Linux )

It definitely has nothing to do with java.

Revision history for this message
RaiMan (raimund-hocke) wrote :

Seems to be something else:
the .so are correctly copied to tmp/tmplib. (https://answers.launchpad.net/sikuli/+question/139304)

Revision history for this message
Kristian Karl (kristian-hermann-karl) wrote :

I have the same problem, but I get a different stack trace (I am using the same Java code example as above)

Sikuli vision engine loaded.
Text Recgonizer inited.
Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Ljava/lang/String;)V
 at edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Native Method)
 at edu.mit.csail.uid.Vision.initOCR(Vision.java:47)
 at edu.mit.csail.uid.TextRecognizer.init(TextRecognizer.java:40)
 at edu.mit.csail.uid.TextRecognizer.<init>(TextRecognizer.java:24)
 at edu.mit.csail.uid.TextRecognizer.getInstance(TextRecognizer.java:45)
 at edu.mit.csail.uid.TextRecognizer.<clinit>(TextRecognizer.java:16)
 at edu.mit.csail.uid.Finder.<clinit>(Finder.java:22)
 at edu.mit.csail.uid.Region.findNow(Region.java:554)
 at edu.mit.csail.uid.Region.wait(Region.java:257)
 at edu.mit.csail.uid.Region.find(Region.java:215)
 at com.spotify.qa.foo.App.main(App.java:13)

I tried the proposed solution, renaming the .so libraries in META-INF/lib (in the sikuli-script.jar) to either .jnilib or dynlib, but it did not work.

Revision history for this message
Nash (knshetty-live) wrote :

Unfortunately, renaming .so to .dylib in META-INF/lib un-jar-ed sikuli-script.jar does not fix the exceptions: 'java.lang.ExceptionInInitializerError'/'java.lang.NullPointerException'.

Revision history for this message
Nash (knshetty-live) wrote :

One can get ride of the "Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Ljava/lang/String;)V" by setting-up your Eclipse project to incorporate 'sikuli-script.jar' as a 'User Library' [Important Note! The 'System library (added to the boot class path)' check box must be selected].

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
How to setup eclipse project to incorporate 'sikuli-script.jar' as a 'User Library' and select the check box 'System library'?
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Step1('Libraries' setting): In Eclipse right click your root project > Properties > Java Build Path > Libraries > Add Library...

Step2(Configure user library): Now in the 'Add Library' dialog, Select 'User Library' & click 'Next >'
Now, Click 'User Libraries...'
Now, in the 'Preferences (Filtered)/User Libraries' dialog, Click 'New...'
In the 'New User Library' dialog, just type an alias name for the Sikuli library (for e.g. 'sikuliX1RC1Linux64bit'). Note! It's important to select the check box that says 'System library (added to the boot class path)'. If you don't select the check box 'System library' then you will get "Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.mit.csail.uid.VisionProxyJNI.Vision_initOCR(Ljava/lang/String;)V". Now, you can click 'OK' in the dialog 'New User Library'.

Step3: Now, make sure your newly defined user library is select and click 'Add Jars...' and add the file 'sikuli-script.jar'. Click 'OK' twice. Now make sure that the newly configured user library's check box is selected and click 'Finish' ('Add Library' dialog). Finally, click 'OK' ('Properties' dialog).

Revision history for this message
Kristian Karl (kristian-hermann-karl) wrote :

Pls see solution at https://answers.launchpad.net/sikuli/+question/139341

In short, the package name is changed from edu.mit.csail.uid to org.sikuli.script

Revision history for this message
Nash (knshetty-live) wrote :

Thanks for the support :)
Declaring the import package as below has solved the problem:
import org.sikuli.script.*;

RaiMan (raimund-hocke)
summary: - Java NullPointerException when using Sikuli-X-1.0-RC1's 'sikuli-
- script.jar' with Java program on Linux Ubuntu 10.04 64bit
+ X 1.0rc1 sikuli-script.jar not working on Linux Ubuntu 10.04 64bit
RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Incomplete
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.