David Ellingson <[EMAIL PROTECTED]> wrote:

> I am having a problem with the following type of tag:
> 
>     <java classname="className" classpath="${classpath}" >
>          <arg line="${dir}/*.txt" />
>     </java>
> 
> I get the following error:
>   /tmp/*.txt (No such file or directory)
> 
> The problem occurs because filename generation does not occur for
> the *.txt expression.  I determined that this was caused by the
> following line in the antRun script: exec $CMD "$@"

As long as you don't say fork="true" this script won't run at all.

> The quotes around the $@ prevent the filename generation.  I can get
> my java task to work when I remove the quotes in the antRun script.

But the same step will break a lot of other things.  The quotes ensure
that arguments that contain spaces will still be considered single
arguments.

Finally, in some circumstances - you are running a JDK 1.3 or higher
or you don't need to change the cwd - the script won't be used at
all.  So changing it won't get you anywhere.

You are relying on the shell glob expansion mechanism, which you
cannot do unless you are sure that a shell will be involved.  A better
solution would be to use execon and a fileset - something like

<execon executable="${java.home}/bin/java" parallel="true">
  <arg value="-classpath" />
  <arg path="${classpath}" />
  <arg value="className" />
  <srcfile />

  <fileset dir="${dir}" includes="*.txt" />
</execon>

At some point in the future there's going to be a javaon or similar
that doesn't imply forked execution.

Stefan

Reply via email to