← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #134217]: Using Java API on Mac, some error that caused by OpenCV

 

Question #134217 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/134217

RaiMan posted a new comment:
The world has turned since November - and things have moved ;-)

*********** Mac ONLY ************

That is exactly, what I am doing in the moment with X 1.0 rc1:

(if you do not need it right now, wait for rc2 - there it will work out
of the box ;-)

--- I use ALL native libraries that come with the distribution (Sikuli-
IDE.app/Contents/Frameworks) (no extra install of openCV, no copy/move
things to /opt/.... or /usr/...)

--- Step 1:
I use this script to change everything to @loader_path in this original Frameworks folder (has to be run there):

for dylib in *.dylib *.jnilib
do
   echo ------- $dylib
   for ref in `otool -L $dylib | grep "@executable" | awk '{print $1'}`
   do
      echo $ref
      new="@loader_path"/`basename $ref`
      echo $new
      install_name_tool -change $ref $new $dylib
   done
done

- Now test: Sikuli-IDE.app should run without any problems.

--- Step 2:
But since in the 
DefaultJniExtractor
they are looking for the existence of "Sikuli-IDE.app/Contents/Frameworks" in the current directory and if this is not found, they switch to java.library.tmpdir. Another copy of the jnilibs is in sikuli-script.jar, that are then copied to the tempdir - uuuups and it still crashes.

So I had to cheat the code and replace the original jnilib in sikuli-
script.jar/Meta-INF/lib with the modified ones from the Frameworks
(unjar sikuli script-jar, replace the jnilibs, jar again) in the
standard place inside Sikuli-IDE.app.

- Again test: Sikuli-IDE.app should run without any problems.

Step 3:

The last thing I had to do was to set java.library.tmpdir to
/Applications..../Frameworks before I use "from sikuli.Sikuli import *"
and all works well (with the add on, that everytime the 3 jnilibs are
unnecessarily copied ;-)

tmpdir = '/Applications/Sikuli-IDE.app/Contents/Frameworks'
import java
if not java.lang.System.getProperty('java.library.tmpdir'):
	java.lang.System.setProperty('java.library.tmpdir', tmpdir)

hope it helps

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.