且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Eclipse中生成JNI头文件

更新时间:2023-09-15 16:55:40

使用以下面板为javah.exe定义一个新的外部工具。



将位置指向javah.exe工具。



将工作目录设置为

  $ {workspace_loc:/ $ {project_name} / bin} 

将参数设置为:

  -classpath $ {project_classpath} -v -d $ {workspace_loc:/ $ {project_name } / src} $ {java_type_name} 



要运行该工具,请在程序包资源管理器中突出显示java源文件并运行该工具。





按F5刷新项目查看新生成的文件。


I am using Eclipse to generate a JNI header file. I looked in program files\java\jre6\bin and found a lot of .exe and .dll files, but I couldn't find the command javah which was in the documentation for using JNI to create bindings to C libraries.
Any help?

Use the following panel to define a new external tool for javah.exe.

Point "Location" to the javah.exe tool.

Set "Working Directory" to

${workspace_loc:/${project_name}/bin}

Set "Arguments" to:

-classpath ${project_classpath} -v -d ${workspace_loc:/${project_name}/src} ${java_type_name}

To run the tool, highlight the java source file in package explorer and run the tool.

Press F5 to refresh th project to see the newly generated file.