javah

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon Mar 12 19:31:13 PDT 2012


On 03/12/2012 06:27 PM, Greg Brown wrote:
>> Same results.
> That's weird. I'll try to run your tests on my machine with Java 6 and 7 and see what happens.
>
> Thanks!
> G
>

Greg,

The behavior *does* appear to change with Ant's <javah> task.

The Ant <javah> task does not support the fork attribute, so I had to 
write the Ant script such that it could be invoked multiple times, with 
different values for JAVA_HOME.  And yes, when running Ant <javah> on 
JDK 5 or JDK 6, you just get the headers for the classes you specify; in 
JDK 7 or 8 you get the additional headers for the nested classes as well.

We are getting off-topic for macosx-port;  I suggest you follow up 
directly to me or compiler-dev. Issues with <javah> should be filed 
against Ant.

-- Jon

> <project>
>
> <target name="default">
> <delete dir="classes"/>
> <delete dir="jdk${jdk}"/>
>
> <mkdir dir="classes"/>
> <javac fork="true" executable="/opt/jdk/1.5.0/bin/javac"
>     srcdir="src" destdir="classes">
> <compilerarg file="src/p/C.java"/>
> </javac>
>
> <mkdir dir="jdk${jdk}"/>
> <javah classpath="classes" destdir="jdk${jdk}">
> <class name="p.C"/>
> </javah>
>
> <exec executable="/usr/bin/find">
> <arg line="jdk${jdk}"/>
> </exec>
>
> </target>
> </project>

> $ for i in 5 6 7 8 ; do JAVA_HOME=/opt/jdk/1.$i.0 ant -f 
> play/build.xml -Djdk=$i default ; done
> Buildfile: play/build.xml
>
> default:
>    [delete] Deleting directory /w/jjg/work/javah/play/classes
>    [delete] Deleting directory /w/jjg/work/javah/play/jdk5
>     [mkdir] Created dir: /w/jjg/work/javah/play/classes
>     [javac] Compiling 1 source file to /w/jjg/work/javah/play/classes
>     [mkdir] Created dir: /w/jjg/work/javah/play/jdk5
>      [exec] jdk5
>      [exec] jdk5/p_C.h
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
> Buildfile: play/build.xml
>
> default:
>    [delete] Deleting directory /w/jjg/work/javah/play/classes
>    [delete] Deleting directory /w/jjg/work/javah/play/jdk6
>     [mkdir] Created dir: /w/jjg/work/javah/play/classes
>     [javac] Compiling 1 source file to /w/jjg/work/javah/play/classes
>     [mkdir] Created dir: /w/jjg/work/javah/play/jdk6
>      [exec] jdk6
>      [exec] jdk6/p_C.h
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
> Buildfile: play/build.xml
>
> default:
>    [delete] Deleting directory /w/jjg/work/javah/play/classes
>    [delete] Deleting directory /w/jjg/work/javah/play/jdk7
>     [mkdir] Created dir: /w/jjg/work/javah/play/classes
>     [javac] Compiling 1 source file to /w/jjg/work/javah/play/classes
>     [mkdir] Created dir: /w/jjg/work/javah/play/jdk7
>      [exec] jdk7
>      [exec] jdk7/p_C_Inner.h
>      [exec] jdk7/p_C.h
>
> BUILD SUCCESSFUL
> Total time: 1 second
> Buildfile: play/build.xml
>
> default:
>    [delete] Deleting directory /w/jjg/work/javah/play/classes
>    [delete] Deleting directory /w/jjg/work/javah/play/jdk8
>     [mkdir] Created dir: /w/jjg/work/javah/play/classes
>     [javac] Compiling 1 source file to /w/jjg/work/javah/play/classes
>     [mkdir] Created dir: /w/jjg/work/javah/play/jdk8
>      [exec] jdk8
>      [exec] jdk8/p_C_Inner.h
>      [exec] jdk8/p_C.h
>
> BUILD SUCCESSFUL
> Total time: 1 second



More information about the macosx-port-dev mailing list