简体   繁体   中英

Makefile: Fatal error: jni.h: No such file or directory

I am trying to make this library and I am following instructions in Maven paragraph. However, I fail on step

make clean all

with the following error:

ObjectManager.c:35:17: fatal error: jni.h: No such file or directory
#include <jni.h>

So, following answers from this question and this question I am trying to add the location of jni.h file to compiler flags. In my case, this file is located in

/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include

What I have tried so far:

make -I/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include clean all
make -I"${JAVA_HOME}/include" -I"${JAVA_HOME}/include/linux" clean all
export JAVA_INCLUDE_DIR=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/include

In short, none of the proposed solutions worked and makefile still fails with the same error. How to solve this?

This library already has the correct settings [see CFLAGS]. From its makefile in target/jni:

IDIR =./include
CC=gcc
CFLAGS=-fPIC -Wall -g -I. -I$(IDIR) -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $(shell pkg-config --cflags $(PKGDEPS))

This most likely means your JAVA_HOME is not set correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM