Reputation: 4765
Exactly what the title says.
I have a class which declares certain native
methods, but also has a couple of inner classes. The javah
utility insists on generating separate headers for the inner classes even though they don't have any native
method declarations. Is there a way to force javah
to stop doing this (annotations, secret command-line switches, anything)?
Upvotes: 2
Views: 603
Reputation: 20812
I don't know any way to do that. (I use the Oracle JDK.)
I understand the annoyance but the problem is limited to unnecessary files and their unnecessary regeneration (outer class changes result in rewriting the useless header files for inner classes).
To solve the problem, I just delete all the empty header files. I use Ant, since it is available as a generic project builder step in Eclipse.
<?xml version="1.0" encoding="UTF-8"?>
<project name="javah">
<mkdir dir="javah" />
<javah classpath="bin" destdir="javah">
<!-- list classes here -->
<class name="com.example.Outer" />
<class name="com.example.OuterWithNatives" />
</javah>
<delete>
<fileset dir="javah">
<not>
<contains text="JNIEXPORT" />
</not>
</fileset>
</delete>
</project>
Upvotes: 4