problem with using <arg> with the javah task

View: New views
4 Messages — Rating Filter:   Alert me  

problem with using <arg> with the javah task

by Bill Au :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a need to limit the max heap size of the javah task.  So I am using a
<arg>:

        <javah
          classpath="${build.classes}"
          destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
      force="yes"
          verbose="yes"
          >
          <arg value="-J-Xmx512m"/>
          <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor" />
        </javah>

But it is giving me a illegal argument error:

    [javah] Error: -J-Xmx512m is an illegal argument
    [javah]
    [javah] Usage: javah [options] <classes>
    [javah]
    [javah] where [options] include:
    [javah]
    [javah]     -help                 Print this help message and exit
    [javah]     -classpath <path>     Path from which to load classes
    [javah]     -bootclasspath <path> Path from which to load bootstrap
classes
    [javah]     -d <dir>              Output directory
    [javah]     -o <file>             Output file (only one of -d or -o may
be used)
    [javah]     -jni                  Generate JNI-style header file
(default)
    [javah]     -version              Print version information
    [javah]     -verbose              Enable verbose output
    [javah]     -force                Always write output files
    [javah]
    [javah] <classes> are specified with their fully qualified names (for
    [javah] instance, java.lang.Object).
    [javah]

When I invoke javah directly with the same argument it actually works
without error:

javah -J-Xmx512m -classpath build/classes
org.apache.hadoop.io.compress.zlib.ZlibCompressor

What am I doing wrong?

Bill

Re: problem with using <arg> with the javah task

by Steve Loughran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bill Au wrote:

> I have a need to limit the max heap size of the javah task.  So I am using a
> <arg>:
>
>         <javah
>           classpath="${build.classes}"
>           destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
>       force="yes"
>           verbose="yes"
>           >
>           <arg value="-J-Xmx512m"/>
>           <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor" />
>         </javah>

>
> When I invoke javah directly with the same argument it actually works
> without error:
>
> javah -J-Xmx512m -classpath build/classes
> org.apache.hadoop.io.compress.zlib.ZlibCompressor
>
> What am I doing wrong?
>
> Bill
>


I suspect the Main method that <javah> is calling doesn't recognise the
-J options, because the native javah binary handles that bit early on,
so it's getting confused.

Problem is, I don't currently see how to set memory options on <javah>;
you'd need to tweak
org.apache.tools.ant.taskdefs.optional.javah.SunJavah to look for -J
options and pass them down

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: problem with using <arg> with the javah task

by Francis Galiegue-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 15, 2009 at 15:37, Bill Au <bill.w.au@...> wrote:

> I have a need to limit the max heap size of the javah task.  So I am using a
> <arg>:
>
>        <javah
>          classpath="${build.classes}"
>          destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
>      force="yes"
>          verbose="yes"
>          >
>          <arg value="-J-Xmx512m"/>
>          <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor" />
>        </javah>
>

Have you tried using <jvmarg> instead of <arg>?
--

Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
fge@...
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: problem with using <arg> with the javah task

by Bill Au :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just tried but it seems that <jvmarg> is not valid for the javah task:

javah doesn't support the nested "jvmarg" element.


Bill

On Thu, Oct 15, 2009 at 9:53 AM, Francis GALIEGUE <fge@...> wrote:

> On Thu, Oct 15, 2009 at 15:37, Bill Au <bill.w.au@...> wrote:
> > I have a need to limit the max heap size of the javah task.  So I am
> using a
> > <arg>:
> >
> >        <javah
> >          classpath="${build.classes}"
> >          destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
> >      force="yes"
> >          verbose="yes"
> >          >
> >          <arg value="-J-Xmx512m"/>
> >          <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor"
> />
> >        </javah>
> >
>
> Have you tried using <jvmarg> instead of <arg>?
> --
>
> Francis Galiegue
> ONE2TEAM
> Ingénieur système
> Mob : +33 (0) 683 877 875
> Tel : +33 (0) 178 945 552
> fge@...
> 40 avenue Raymond Poincaré
> 75116 Paris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>