lobBob
Posts: 3
Joined: Mon Jun 19, 2017 4:07 pm

cmake does not find jni/java

Wed Jun 21, 2017 4:16 pm

hi all, been pulling my hair out in trying to build the java wrappers for opencv 3.2. no matter what i install as the java jdk, and no matter what i set as JAVA_HOME, my Root CMake File for OpenCV does not honor the JAVA_HOME path. Ant is found but the line on JNI: remains stubbornly on NO ... so i used dakcarto's CMAKEList.txt for Find-JNI-JAVA-Test <https://gist.github.com/dakcarto/8329063> and ran it on my pi with these results (see below). if anyone can suggest a solution i would be eternally grateful, thanks, robert

-- JAVA_HOME= /usr/lib/jvm/java-8-openjdk-armhf
-- CMAKE_FIND_FRAMEWORK=
--
-- Found JNI: /usr/lib/jvm/default-java/jre/lib/arm/libjawt.so
-- _JAVA_HOME= /usr/lib/jvm/java-8-openjdk-armhf
--
-- JNI_INCLUDE_DIRS= /usr/lib/jvm/java-8-openjdk-armhf/include;/usr/lib/jvm/java-8-openjdk-armhf/include/linux;/usr/lib/jvm/java-8-openjdk-armhf/include
-- JNI_LIBRARIES= /usr/lib/jvm/default-java/jre/lib/arm/libjawt.so;/usr/lib/jvm/default-java/jre/lib/arm/server/libjvm.so
-- JAVA_AWT_LIBRARY= /usr/lib/jvm/default-java/jre/lib/arm/libjawt.so
-- JAVA_JVM_LIBRARY= /usr/lib/jvm/default-java/jre/lib/arm/server/libjvm.so
-- JAVA_INCLUDE_PATH= /usr/lib/jvm/java-8-openjdk-armhf/include
-- JAVA_INCLUDE_PATH2= /usr/lib/jvm/java-8-openjdk-armhf/include/linux
-- JAVA_AWT_INCLUDE_PATH= /usr/lib/jvm/java-8-openjdk-armhf/include
--
CMake Warning at CMakeLists.txt:41 (find_package):
By not providing "FindJAVA.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "JAVA", but
CMake did not find one.

Could not find a package configuration file provided by "JAVA" with any of
the following names:

JAVAConfig.cmake
java-config.cmake

Add the installation prefix of "JAVA" to CMAKE_PREFIX_PATH or set
"JAVA_DIR" to a directory containing one of the above files. If "JAVA"
provides a separate development package or SDK, be sure it has been
installed.


-- _JAVA_HOME= /usr/lib/jvm/java-8-openjdk-armhf
--
-- Java_JAVA_EXECUTABLE=
-- Java_JAVAC_EXECUTABLE=
-- Java_JAVAH_EXECUTABLE=
-- Java_JAVADOC_EXECUTABLE=
-- Java_JAR_EXECUTABLE=
-- Java_VERSION_STRING=
-- Java_VERSION_MAJOR=
-- Java_VERSION_MINOR=
-- Java_VERSION_PATCH=
-- Java_VERSION_TWEAK=
-- Java_VERSION=
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi

lobBob
Posts: 3
Joined: Mon Jun 19, 2017 4:07 pm

Re: cmake does not find jni/java

Wed Jun 21, 2017 11:58 pm

Guess changing this from a question to a bug report. Generated the cmake with cmake-gui instead. There i specified the java paths totally consistent with the path set for my java_home env var and it generated without any problem... So i take it that the command line cmake is not properly executing the find jni even though java_home is defined correctly.

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: cmake does not find jni/java

Fri Jun 23, 2017 6:47 am

If it's a bug you'll need to report it to the Cmake developers.
https://gitlab.kitware.com/cmake/cmake/issues

But before doing that read the existing bugs
https://gitlab.kitware.com/cmake/cmake/ ... earch=Java
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Troubleshooting”