简体   繁体   English

找不到JNI.h标头

[英]JNI.h header cannot be found

I'm trying to create a JNI application between java and c++ and the include #include is telling me that jni.h cannot be found. 我试图在Java和C ++之间创建一个JNI应用程序,并且include #include告诉我找不到jni.h。 I've looked at a half dozen threads and web pages and tried fixes that haven't worked. 我查看了六个线程和网页,并尝试了无效的修复程序。 I don't have anything in the path Library/Framework/JavaVM.framework if that helps, and I can't figure out how to get it. 如果有帮助,我的路径Library / Framework / JavaVM.framework中没有任何内容,而且我不知道如何获得它。

I'm trying to build a JNI project. 我正在尝试建立一个JNI项目。 I know that jni.h is in the path /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include but for some reason this makefile isn't working. 我知道jni.h在/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include路径中,但是由于某些原因,该makefile无法正常工作。

EDIT: also, I'm using eclipse if that matters. 编辑:另外,如果那很重要,我正在使用Eclipse。

# Define a variable for classpath
CLASS_PATH = ../bin

# Define a virtual path for .class in the bin directory
vpath %.class $(CLASS_PATH)

all : hpaprogram.dll

# $@ matches the target, $< matches the first dependancy
hpaprogram.dll : HPAProgram.o
    gcc -Wl,--add-stdcall-alias -shared -o $@ $<

# $@ matches the target, $< matches the first dependancy
HPAProgram.o : HPAProgram.c++ HPAProgram.h
    gcc -I"/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include" -c $< -o $@

# $* matches the target filename without the extension
HPAProgram.h : HPAProgram.class
    javah -classpath $(CLASS_PATH) $*

clean :
    rm HPAProgram.h HPAProgram.o hpaprogram.dll

I figured it out. 我想到了。 My JavaVM.framework was actually in /System/Library/Framework/JavaVM.framework 我的JavaVM.framework实际上位于/System/Library/Framework/JavaVM.framework中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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