Parameters in Java task

Discussion in 'Java' started by andrewzzz, Mar 1, 2007.

  1. andrewzzz

    andrewzzz Guest

    Hi guys,
    The java class that I wan't to run (with java task) requires a
    commandline parameter : a single String character.
    I know that in the build.xml I can specify attributes...but It's not
    possible to let the user choose...
    How do I let the user insert a command line parameter???
    Thanks a lot!!!

    actual target
    <target name="initiator" depends="compile"
    description="execute app.initiator,requires config parameter">
    <java classname="app.Initiator" fork="true" classpath="classes"/>
    andrewzzz, Mar 1, 2007
    #1
    1. Advertising

  2. "andrewzzz" <> writes:

    > Hi guys,
    > The java class that I wan't to run (with java task) requires a
    > commandline parameter : a single String character.
    > I know that in the build.xml I can specify attributes...but It's not
    > possible to let the user choose...
    > How do I let the user insert a command line parameter???
    > Thanks a lot!!!
    >
    > actual target
    > <target name="initiator" depends="compile"
    > description="execute app.initiator,requires config parameter">
    > <java classname="app.Initiator" fork="true" classpath="classes"/>
    >


    How about:

    <target name="example">
    <echo>${set.me}</echo>
    </target>

    Then on the command line

    ant -Dset.me="Whatever you like" example


    --
    Mark Jeffcoat
    Austin, TX
    Mark Jeffcoat, Mar 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor
    Replies:
    0
    Views:
    8,819
    Victor
    Sep 1, 2004
  2. krabhi
    Replies:
    1
    Views:
    9,262
    Marco Meschieri
    Aug 9, 2006
  3. teggy
    Replies:
    0
    Views:
    804
    teggy
    May 29, 2007
  4. Mike
    Replies:
    1
    Views:
    1,919
    GArlington
    May 12, 2008
  5. Stéphane Wirtel
    Replies:
    3
    Views:
    355
    Stephane Wirtel
    Jun 15, 2007
Loading...

Share This Page