Friday, October 14, 2016

Building OpenCV with Java on Linux

This command worked for me:
cmake .. -DJAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-oracle/include/ -DJAVA_INCLUDE_PATH2=/usr/lib/jvm/java-8-oracle/include/linux
It was not necessary to set BUILD_SHARED_LIBS to false as described on That would be rather undesirable to lose the ability to use shared libs just because you also want to use Java!

**HOWEVER**, because BUILD_SHARED_LIBS is set, will have dependencies. It will be necessary to load among others into the JVM at runtime, AND THEN to have see those symbols. This is tricky in Java! If you don't want to go through this pain, you can go and unset BUILD_SHARED_LIBS; I won't judge you.

Essentially, what you need is a way to set RTLD_GLOBAL when loading the library. This can be accomplished using JNA:
 Then you should be able to use OpenCV.


  1. OpenCV supports desktop Java development using nearly the same interface as for Android development. This guide will help you to create your first Java application using OpenCV.
    Java Certification Training in Chennai

  2. The French cards were known as "Vingt-et-Un," which translates to "Twenty-one." These cards are most likely derived from card video games Chemin de Fer, which were in style at the moment. 1xbet The card sport was played on the French Royal Court during the reign of King Louis XV. Live supplier blackjack is a variant where the playoffs are dealt by an actual supplier.