I am using cmake 2.8.7 on Ubuntu 12.04 amd64. The installed OpenJDK JRE components in my system are listed below :
$ sudo dpkg --list | grep jdk
openjdk-6-jre 6b27-1.12.5-0ubuntu0.12.04.1 OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless 6b27-1.12.5-0ubuntu0.12.04.1 OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-6-jre-lib 6b27-1.12.5-0ubuntu0.12.04.1 OpenJDK Java runtime (architecture independent libraries)
However, I am not using the OpenJDK JRE components. I have manually installed Oracle Java 7 JDK
in "/usr/lib/jvm/jdk1.7.0_25" and have used "update-alternatives" to point "java" to my installed Oracle Java 7 JDK. I have not set any "JAVA_HOME", "JAVA_BIN", "CLASSPATH" environment variables and the manually installed Oracle Java 7 JDK seems work OK in Eclipse 4.3.
The problem is that when I use "find_package(JNI)" in cmake and use the "message()" function to show the JNI variables, I have the following result :
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
JNI_FOUND = FALSE
JNI_LIBRARIES = /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
JAVA_INCLUDE_PATH = JAVA_INCLUDE_PATH-NOTFOUND
JAVA_INCLUDE_PATH2 = JAVA_INCLUDE_PATH2-NOTFOUND
JAVA_AWT_INCLUDE_PATH = JAVA_AWT_INCLUDE_PATH-NOTFOUND
JAVA_JVM_LIBRARY = /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
JAVA_AWT_LIBRARY = /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/libjawt.so
JNI_INCLUDE_DIRS = JAVA_INCLUDE_PATH-NOTFOUND;JAVA_INCLUDE_PATH2-NOTFOUND;JAVA_AWT_INCLUDE_PATH-NOTFOUND
The "find_package(JNI)" seems could find some of the Java components related to the OpenJDK JRE and could not find my current Oracle Java 7 JDK components pointed by "update-alternatives".
I want to know that is there any bug in the "FindJNI.cmake" file and what I have missed in the Oracle Java 7 JDK setup so that cmake "find_package(JNI)" could work properly.
Thanks for any suggestion.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…