I'm trying to install OpenCV on Raspbian so that I can deploy my Java code onto the RPi. However, having cmake find JNI is proving to be an irksome task. One question that was answered here noted that the administrator needed to have JAVA_HOME set as well, not just the user. So I set it in /etc/environment as well as the prior setting in .bashrc.
How to resolve "Could not find JNI", building OpenCV on Raspberry Pi?
However, cmake still cannot find JNI, even after I updated it to find the Include directories as noted in the following;
cmake find_package(JNI) not work in Ubuntu 12.04 amd64
I've tried many different combinations, including the Java installation and environment setting at, though it unzips java in /opt/java and recommends setting JAVA_HOME to there;
http://elinux.org/RPi_Java_JDK_Installation
Pertinent FindJNI.cmake lines include;
SET(JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
${_JAVA_HOME}/include
/usr/include
/usr/local/include
/usr/lib/java/include
/usr/local/lib/java/include
/usr/lib/jvm/jdk-7-oracle-armhf/include <-- Added by me
and
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
${_JAVA_HOME}/jre/lib/{libarch}
${_JAVA_HOME}/jre/lib
${_JAVA_HOME}/lib
${_JAVA_HOME}
/usr/lib
/usr/local/lib
/usr/lib/jvm/java/lib
/usr/lib/java/jre/lib/{libarch}
/usr/lib/jvm/jdk-7-oracle-armhf
/usr/lib/jvm/jdk-7-oracle-armhf/lib
/usr/lib/jvm/jdk-7-oracle-armhf/lib/{libarch}
/usr/lib/jvm/jdk-7-oracle-armhf/{libarch}
Pertinent OpenCV install script lines include;
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=OFF -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON WITH_QT=ON -D WITH_OPENGL=ON ..
make -j 8
sudo make install
Cmake output includes;
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)
System is unknown to cmake, create: Platform/error pid:6186, boost::interprocess::bad_alloc Linux to use this system, please send your config file to cmake@www.cmake.org so
I'm at a loss for any more clues to load OpenCV on Raspbian where Java can be used - what else do I need to do?