NDK: ant 错误 [javah] Exception in thread "main" java.lang.NullPointerException

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 second

ant脚本内容:
<?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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值