0

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>

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?

1 Answers1

1

Did you check the default version of installed JREs?

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.

Bruce
  • 118
  • 1
  • 8