You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Oisin Kim <oi...@aurium.net> on 2002/04/17 17:35:23 UTC

RE: Run time commands - a Solution

Hi All,

Ok thanks, that's much clearer now, my only apology is that I didn't
make myself clearer from the first email, I was clearly asking the wrong
question!

Just for the benefit of anyone who will need to do something like this
again. 
Here's a sample target which will allow user input from System.in or the
running Java application:

<target name="run-with-user-input" depends="build-classes">
<!--build-classes will simply build the classes used by this task-->
    <java classname="org.apache.SomeClassName" >      
      <classpath refid="some.classpath"/> <!--the classpath-->
      <arg value="some.properties"/> 	<!--a paramter, a properties
file-->
      <arg value="somefilename.txt"/>	<!--a paramter, some file
name-->
      <arg value="-mnop"/>			<!--a paramter, passing
options in-->
    </java>
</target>

Since this java command no longer uses the option "fork=true" you can't
define a Path to run java from, everything is run relative to the folder
the Ant build script is contained (if you run Ant from the command line)
in or if you're using something like netbeans, relative to the netbeans
bin directory, although this may be just a config issue! (sorry for the
OT ness of that!)

Hope this helps someone!

Much thanks go to Stefan and Kevin!

Oisin
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Run time commands - a Solution

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 17 Apr 2002, Oisin Kim <oi...@aurium.net> wrote:

>       <arg value="some.properties"/> 	<!--a paramter, a properties file-->
>       <arg value="somefilename.txt"/>	<!--a paramter, some file name-->

> Since this java command no longer uses the option "fork=true" you
> can't define a Path to run java from, everything is run relative to
> the folder the Ant build script is contained (if you run Ant from
> the command line) in or if you're using something like netbeans,
> relative to the netbeans bin directory, although this may be just a
> config issue!

Use

   <arg file="some.properties"/> 	<!--a paramter, a properties file-->
   <arg file="somefilename.txt"/>	<!--a paramter, some file name-->

instead

Ant will pass the absolute pathname of the files on the command line
and assume that relative paths are relative to your project's basedir.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>