JNI:“使用 'makefile' 时目标 'HelloJNI.h' 的接收失败

JNI : "receipe for target 'HelloJNI.h' failed while using the 'makefile'

我正在尝试将 JNI 与 Eclipse 一起使用,使用 this tutorial,但我未能按照“Eclipse 中的 2.6 JNI - 第 3 步”部分中的说明使用 makefile。

当我右键单击 jni 文件夹,选择 "Build targets" => "Build" => 并选择目标 HelloJNI.h => 构建时,我收到以下错误消息:

10:19:12 **** Build of configuration Default for project HelloJNI **** make HelloJNI.h javac -h -classpath ../bin HelloJNI makefile:10: recipe for target 'HelloJNI.h' failed process_begin: CreateProcess(NULL, javac -h -classpath ../bin HelloJNI, ...) failed. make (e=2): Le fichier spécifié est introuvable.

make: *** [HelloJNI.h] Error 2

10:19:13 Build Finished (took 801ms)

下面显示的 makefile 文件的最后一行表示有错误(但是是哪一个?)

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

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

HelloJNI.h : HelloJNI.class
    javac -h -classpath $(CLASS_PATH) $*

我检查过我在 "C:\MinGW\bin" 中有一个 "make" 文件。我没有,所以我复制了 "mingw32-make.exe" 并将其重命名为 "make.exe".
我还尝试将最后一个指令 javac -h (...) 更改为 javah (...) 但我得到了同样的错误。

我想错误行

CreateProcess(NULL, javac -h -classpath ../bin HelloJNI, ...) failed. make (e=2): Le fichier spécifié est introuvable. [The specified file is not found.]

应该可以帮助我理解哪里出了问题,但我没有成功。

感谢您的帮助

错误不是来自 javac ´- 它是由 javac 不在 PATHCreateProcess 系统中引起的call 无法找到它,因此命令不会执行。 after javac 所做的任何更改都无济于事。可能的修复例如

  • 正在将 javac 的路径添加到 PATH...
  • 使用完整路径调用 javac

    c:/Foo/Bar/JavaSDK/bin/whatever/javac -h -classpath $(CLASS_PATH) $*