在Eclipse Indigo中使用ANT时出现javah NullPointerException [英] javah NullPointerException while using ANT in Eclipse Indigo

查看:133
本文介绍了在Eclipse Indigo中使用ANT时出现javah NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ANT buildscript,如下所示:

I'm using an ANT buildscript like so:

<project basedir="..">
<property name="src" location="src"/>
<property name="classes" location="classes" />
<property name="jnifiles" location="jnifiles" />

<target name="init">
    <mkdir dir="${classes}" />
    <mkdir dir="${jnifiles}" />
</target>

<target name="compile" 
    description="compile the source " >
    <javac srcdir="${src}" destdir="${classes}" includeantruntime="false" />
</target>

<target name="generate-jni">
    <javah destdir="${jnifiles}" >
        <class name="com.example.ExecJNI" />
    </javah>
</target>

<target name="clean"
    description="clean up" >
    <delete dir="${classes}"/>
    <delete dir="${jnifiles}"/>
</target>

它经过清理,初始化和编译就很好了,但是在generate-jni时出现以下错误:

It goes through clean, init and compile just fine, but at generate-jni I get the following error:

generate-jni:
   [javah] Exception in thread "main" java.lang.NullPointerException
   [javah]  at com.sun.tools.javah.JavahTask.run(JavahTask.java:509)
   [javah]  at com.sun.tools.javah.JavahTask.run(JavahTask.java:335)
   [javah]  at com.sun.tools.javah.Main.main(Main.java:46)

有人知道我在做什么错吗?

Anyone have a clue what I'm doing wrong?

推荐答案

您是否检查了已安装JRE的默认版本?

Did you check the default version of installed JREs?

我也遇到了同样的问题,并且在Eclipse首选项中检查了已安装的JRE. 尽管我确实安装了jdk1.7,但默认版本是jre7. 将默认版本更改为jdk1.7后,此问题已解决.

I had the same problem too and I checked installed JREs in Eclipse preferences. The default version is jre7 though I indeed installed jdk1.7. After changing the default version to jdk1.7, the problem is solved.

希望此信息对您有所帮助.

Hope this information helps you.

这篇关于在Eclipse Indigo中使用ANT时出现javah NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆