【问题标题】:JNI.h header cannot be found找不到 JNI.h 标头
【发布时间】:2014-02-05 08:06:05
【问题描述】:

我正在尝试在 java 和 c++ 之间创建一个 JNI 应用程序,而 include #include 告诉我找不到 jni.h。我查看了六个线程和网页,并尝试了一些无效的修复。如果有帮助,我在路径 Library/Framework/JavaVM.framework 中没有任何内容,而且我不知道如何获取它。

我正在尝试构建一个 JNI 项目。我知道 jni.h 位于 /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/include 路径中,但由于某种原因,此 makefile 无法正常工作。

编辑:另外,如果这很重要,我正在使用 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

【问题讨论】:

  • JNI 位于:C:\Program Files (x86)\Java\jdk1.7.0_51\include.. 它位于 JDK 安装位置的包含文件夹中..
  • 不是 Android 的正确“答案”。

标签: java c++ macos java-native-interface


【解决方案1】:

我想通了。我的 JavaVM.framework 实际上在 /System/Library/Framework/JavaVM.framework

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-28
    • 2016-04-15
    • 1970-01-01
    • 2017-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多