Ant task:
<target name="regenerateJNIHeader" description="Re-generates the JNI header">
<echo message="Re-generating JNI header" />
<attrib readonly="false">
<fileset dir="." includes="**/MyAPI*.h"/>
</attrib>
<javah class="com.MyAPI" force="yes" verbose="yes"/>
</target>
Problem is, I made a change (added a method) to MyAPI, but, despite clearing the header file and compiled class files, when I run this task, my new method is not added. If I run javah com.MyAPI
, it works properly.
Possible to see the commandline for ant tasks as it executes them?
Solved the issue. Not quite what I was asking, but I found the info I needed.
I set the ant commandline to have -v
(verbose), which printed out much more info. In the output, I saw the classpath, which I had not set. Added the classpath
attribute to the javah task and set it to "."
and now the generated header contains my new method.
I am surmising that, despite not explicitly mentioning it in the classpath (in the javah task verbose output), it must have been looking for the specified class in a jar which I'd placed in $JAVA_HOME/jre/lib/ext
.