我正在使用这样的 ANT buildscript:
<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>
它通过 clean、init 和编译就好了,但是在 generate-jni 我收到以下错误:
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)
有人知道我做错了什么吗?