Version 1.1.4 - Special for Linux people

Getting a JDK and the SikuliX packages (IDE and/or API)

You need a Java JDK version 8 or later.

Since Java 11 will be available from mid September 2018 on, I used that and had success.

openJDK 11 using the latest from the Java 11 EarlyAccess Builds page

  • download the openJDK Linux pack and put the resulting jdk11 folder into your home folder
  • in a Terminal window try <home>/jdk11/bin/java -version - should show up as Java 11

Download the SikuliX IDE jar from the SikuliX Download page and put it in your home into a folder SikuliX

Try to run it in a Terminal Window being in folder SikuliX as:

<home>/jdk11/bin/java -jar sikulix.jar -v

The parameter -v gives full debug output from the very beginning - hence keep it until everything works.

You might get the following error
Gtk-Message: 11:28:51.117: Failed to load module “canberra-gtk-module” solution: sudo apt install libcanberra-gtk0 libcanberra-gtk-module
You might get the following error
Assistive technology not found AWTError look here for possible solutions

The IDE should start up and the GUI should principally work.

Be aware To make it finally useable, you have to make sure, that your system supports OpenCV and Tesseract..

… and if you want to use the App class features you still need xdotool and wmctrl.

For programming with Java you might use the ready to use sikulixapi.jar or the Maven snapshot dependency in a Maven/Gradle project. In any case you have to make OpenCV and Tesseract ready before.

Getting the OpenCV support ready

SikuliX needs access to the OpenCV Java/JNI bindings (an OpenCV native library named, where 320 is a shortcut for the version).

On Debian systems (like Ubuntu) you should get it with the apt-tool, on other Linux systems you might get it with their package-tool. In any case it is possible, to create it from the sources (see below).

Generally needed:

A link (ln -s ...) as in any folder, that is on the library path (e.g. on Ubuntu: /usr/lib), to the real library module

should work on Ubuntu 18.04 (or other actual Debian systems):

sudo apt install libopencv3.2-java
sudo ln -s /usr/lib/jni/ /usr/lib/

A will be in /usr/lib/jni, to where you have to symbolical link On Ubuntu the best place seems to be /usr/lib, but that is up to you, as long as the containing folder is in the current lib path at runtime.

Build OpenCV library from the sources (might be needed on non-Debian Linux)

Get a source package (recommended: 3.4+) and unzip/untar it to a work folder of your choice.

In a terminal session go into the OpenCV folder and make a folder build at the top level. Finally go into that build folder

All the following steps have to be done being inside this build folder.

There are some general prerequisites for the build process to work, that you have to fulfill either before you start or solve it every time you run into a problem. On Ubuntu, the usual way is to use the apt-tool.

You need: cmake, ant, build-tools, Python (2.7 or 3.x) and a Java JDK

All prerequisites must be available/accessible in the standard environment.

In the build folder run the build setup:

cmake ..

As a result you will get some output, which tells you, wether you will have a chance to get a valid

It should look something like that towards the end:

-- General configuration for OpenCV 3.4.2 =====================================

... more

--   C/C++:
--     Built as dynamic libs?:      YES

... more

--   OpenCV modules:
--     To be built:                 core features2d flann imgcodecs imgproc java java_bindings_generator python_bindings_generator
--     Disabled:                    calib3d highgui js ml objdetect photo shape stitching superres video videoio videostab world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev dnn python2 python3 ts viz

... more

--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/ (ver 1.2.11)
--     JPEG:                        build-libjpeg-turbo (ver 1.5.3-62)
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         build (ver 1.6.34)
--     TIFF:                        build (ver 42 - 4.0.9)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--   Video I/O:

.. more

--   Python (for build):            /usr/bin/python3
--   Java:
--     ant:                         /usr/bin/ant (ver 1.10.3)
--     JNI:                         /usr/lib/jvm/java-10-oracle/include /usr/lib/jvm/java-10-oracle/include/linux /usr/lib/jvm/java-10-oracle/include
--     Java wrappers:               YES
--     Java tests:                  NO
--   Matlab:                        NO
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/raiman/SikuliX/opencv-3.4.2/build

Some notes (top down):

  • Built as dynamic libs: you will have to install the built stuff to your system in a second step.
  • OpenCV modules: the list in the line after To be built MUST contain java.
  • Media I/O: at least ZLib, JPEG and PNG must show a valid entry
  • Python (for build): must show a valid Python runner
  • Java: ant and JNI must show valid entries
  • Install to: must make sense

If one or more of the mentioned entries are odd, you have to debug for the reason ;-)

Common problems are (if java is not mentioned in the line To be built), that a Python is not available and a valid JDK is not found in the environment.

The usual way to solve the problems is to install the relevant packages.

Each time you fixed something simply run cmake .. again.

You may fine tune, what you get, by editing the file CMakeCache.txt and run cmake .. again.

The relevant section near the top of CMakeCache.txt:

//Build CUDA modules stubs when no CUDA SDK

//Create build rules for OpenCV Documentation

//Build all examples

//Create Java wrapper exporting all functions of OpenCV library
// (requires static build of OpenCV modules)

//Build IPP IW from source

//Build Intel ITT from source

//Build libjasper from source

//Enable Java support

//Build libjpeg from source

//Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')

//Build openexr from source

//Enables 'make package_source' command

//Build performance tests

//Build libpng from source

//Force to build libprotobuf from sources

//Build shared libraries (.dll/.so) instead of static ones (.lib/.a)

//Download and build TBB from source

//Build accuracy & regression tests

//Build libtiff from source

//Use symlinks instead of files copying during build (and !!INSTALL!!)

//Build WebP from source

//Include debug info into release binaries ('OFF' means default
// settings)

//Enables dynamic linking of IPP (only for standalone IPP)

//Build zlib from source

//Build utility applications (used for example to train classifiers)

//Include opencv_calib3d module into the OpenCV build

//Include opencv_core module into the OpenCV build

//Include opencv_dnn module into the OpenCV build

//Include opencv_features2d module into the OpenCV build

//Include opencv_flann module into the OpenCV build

//Include opencv_highgui module into the OpenCV build

//Include opencv_imgcodecs module into the OpenCV build

//Include opencv_imgproc module into the OpenCV build

//Include opencv_java module into the OpenCV build

//Include opencv_java_bindings_generator module into the OpenCV
// build

//Include opencv_js module into the OpenCV build

//Include opencv_ml module into the OpenCV build

//Include opencv_objdetect module into the OpenCV build

//Include opencv_photo module into the OpenCV build

//Include opencv_python_bindings_generator module into the OpenCV
// build

//Include opencv_shape module into the OpenCV build

//Include opencv_stitching module into the OpenCV build

//Include opencv_superres module into the OpenCV build

//Include opencv_ts module into the OpenCV build

//Include opencv_video module into the OpenCV build

//Include opencv_videoio module into the OpenCV build

//Include opencv_videostab module into the OpenCV build

//Include opencv_world module into the OpenCV build

This example minimizes what is built, to what SikuliX needs, and builds the media i/o libs from the bundled sources. Simply write ON or OFF after the = of an option.

If you made any changes to CMakeCache.txt just run cmake .. again.

When you are finally satisfied with the result, just run:

make install

This will install the stuff into your system (will take some minutes to complete). Be sure, that you have a success: no errors are shown.

As a last step you need to find the installed and as mentioned above create a symbolic link, that is found in the library path.

Getting the Tesseract support ready

You have to make sure, that a is available on your system.

You should first try with your package manager.

It must be a version 3.x (preferably 3.0.4+).
Version 4 cannot be used yet (would be apt-installed on Ubuntu 18.04)

To test, what you have on your system, run this:

tesseract -v

# should show up with something like that:
...> tesseract 3.05.02
...>    leptonica-1.74.4
...>       libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11

If anything looks odd, than you have to dive into the gory details.

On Ubuntu 18.04 the following steps installed a Tesseract 3.0.5

Be aware: this is not a runnable shell script. Only the used commands are listed:

# this worked on Ubuntu 18.04 on August 1st, 2018
# thanks to

# remove tesseract binaries and languages
sudo apt-get remove tesseract-ocr*

# remove leptonica
sudo apt-get remove libleptonica-dev

# make sure other dependencies are removed too
sudo apt-get autoclean
sudo apt-get autoremove --purge

# general preparations
sudo apt-get install autoconf automake libtool
sudo apt-get install autoconf-archive
sudo apt-get install pkg-config
#sudo apt-get install libpng12-dev # did not work
sudo apt-get install libpng-dev # installs 1.6
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff5-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libicu-dev
sudo apt-get install libpango1.0-dev
sudo apt-get install libcairo2-dev

######################### download/install leptonica 1.74.4

# extract to folder and go into folder

# compile/link: this takes some time
sudo make

sudo make install

####################### download/install tesseract 3.05.02

# extract to folder and go into folder

./configure --enable-debug

# compile/link: this takes some time
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make

sudo make install
sudo make install-langs # is a no-op with no additional languages
sudo ldconfig

################## test
tesseract -v

# should show
# tesseract 3.05.02
#    leptonica-1.74.4
#       libjpeg 8d (libjpeg-turbo 1.5.2) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11