Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: jni.h: No such file or directory #1417

Open
machh opened this issue Sep 21, 2023 · 1 comment
Open

error: jni.h: No such file or directory #1417

machh opened this issue Sep 21, 2023 · 1 comment

Comments

@machh
Copy link

machh commented Sep 21, 2023

My environment:

OS: CentOS Linux release 7.9.2009 (AltArch)
arch: aarch64
gcc : 4.8.5
Maven : 3.9.4
jdk : openjdk version "11.0.20"


my steps:

cd javacpp-presets-1.5.3
mvn install -Djavacpp.platform=linux-arm64 -Dmaven.javadoc.skip=true -DskipTests

When I execute the above command, the following error appears:

In file included from /home/javacpp-presets-1.5.3/opencv/cppbuild/linux-arm64/opencv-4.3.0/modules/java/generator/src/cpp/Mat.cpp:8:0:
/home/javacpp-presets-1.5.3/opencv/cppbuild/linux-arm64/opencv-4.3.0/modules/java/generator/src/cpp/common.h:17:17: fatal error: jni.h: No such file or directory
 #include <jni.h>
                 ^
compilation terminated.
make[2]: *** [modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/Mat.cpp.o] Error 1
make[1]: *** [modules/java/jni/CMakeFiles/opencv_java.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....


but , i found

echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.20.0.8-1.el7_9.aarch64

ll /usr/lib/jvm/java-11-openjdk-11.0.20.0.8-1.el7_9.aarch64/include/

total 216
-rw-r--r-- 1 root root 21906 Aug 11 14:47 classfile_constants.h
-rw-r--r-- 1 root root 12458 Aug 11 14:47 jawt.h
-rw-r--r-- 1 root root  8151 Aug 11 14:47 jdwpTransport.h

-rw-r--r-- 1 root root 74987 Aug 11 14:47 jni.h

-rw-r--r-- 1 root root 81790 Aug 11 14:47 jvmti.h
-rw-r--r-- 1 root root  4771 Aug 11 14:47 jvmticmlr.h
drwxr-xr-x 2 root root  4096 Sep 21 04:10 linux

jni.h is at:
/usr/lib/jvm/java-11-openjdk-11.0.20.0.8-1.el7_9.aarch64/include/

@machh
Copy link
Author

machh commented Sep 22, 2023

@saudet

Previously, when I compiled OpenCV with JDK 1.8, I didn't encounter this error. This error started appearing after I switched to OpenJDK 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants