1.错误内容
Buildfile: D:\workspacebin\eclipseWorkspace\HelloNDK\build_headers.xml BuildHeaders: BuildGetStringHeaders: [javah] Exception in thread "main" java.lang.NullPointerException [javah] at com.sun.tools.javah.JavahTask.run(JavahTask.java:503) [javah] at com.sun.tools.javah.JavahTask.run(JavahTask.java:329) [javah] at com.sun.tools.javah.Main.main(Main.java:46) BUILD FAILED D:\workspacebin\eclipseWorkspace\HelloNDK\build_headers.xml:19: The following error occurred while executing this line: D:\workspacebin\eclipseWorkspace\HelloNDK\build_headers.xml:26: compilation failed Total time: 1 secondant脚本内容:
<?xml version="1.0" encoding="UTF-8"?> <!-- ====================================================================== 2016年1月4日 下午10:42:01 HelloNDK description ====================================================================== --> <project name="HelloNDK" default="BuildHeaders"> <description> description </description> <!-- ================================= target: buildHeaders ================================= --> <target name="BuildHeaders" > <antcall target="BuildGetStringHeaders"></antcall> </target> <!-- - - - - - - - - - - - - - - - - - target: BuildGetStringHeaders - - - - - - - - - - - - - - - - - --> <target name="BuildGetStringHeaders"> <javah destdir="./jni" classpath="./bin/classes/" class="com.bubble.hellondk.GetString"></javah> </target> </project>
2.解决方案:
Run -> External Tools -> External Tools Configurations dialog,选择Run in Same JRE as workspace
|
After adding tools.jar to the ant runtime classpath, I also experienced (Eclipse Kepler for Windows 7 64-bit) the javah null pointer exception mentioned above. The correct fix for this subsequent problem was to specify "Run in Same JRE as workspace" on the JRE tab of each ant build file in the Run -> External Tools -> External Tools Configurations dialog. If you have multiple JREs installed, you might have to specify a specific (i.e., separate) JRE from the list of installed JREs |
参考:http://stackoverflow.com/questions/15032230/cant-load-javah-error-in-eclipse
精彩评论