Ant: how to get command-line argument?

When using Ant to build Java source files, what is the syntax of obtaining command-line argument in build.xml?

From the documentation:
http://ant.apache.org/manual/running.html#libs
Examples
ant
runs Ant using the build.xml file in the current directory, on the default target.
ant -buildfile test.xml
runs Ant using the test.xml file in the current directory, on the default target.
ant -buildfile test.xml dist
runs Ant using the test.xml file in the current directory, on the target called dist.
ant -buildfile test.xml -Dbuild=build/classes dist
runs Ant using the test.xml file in the current directory, on the target called dist, setting the build property to the value build/classes.
ant -lib /home/ant/extras
runs Ant picking up additional task and support jars from the /home/ant/extras location
steps:
- You define a property (like ${my.prop}) in your build.xml
- You define it in the command line, like
ant -Dmy.prop=chosen_value compile
where "compile" is the target and "-Dmy.prop=chosen_value" defines the value of the property "my.prop" as "chosen_value".

Similar Messages

  • How to give command line arguments

    does anyone help me out in how to give command line arguments after run my program
    m using netbeans6.0.1

    If you want your program to take console input while it's running (as opposed to command line arguments, which are passed once, when you start your program), you can wrap a BufferdInputStream or a Scanner around System.in.
    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]

  • How to run command line argument programe

    Hi guys, I am doing pass command line argument programe in java but I don't know how to run this programe. Path for this programe in my my computer is C:\Users\Desktop\Mainjava\mycode\CommandProgjava*
    {code/}
    public class CommandProg
    public static void main(String[] args)
    System.out.println("d");
    for (int i = 0; i < args.length; i++)
    System.out.println(args);
    {code/}
    Where i need to go and what command i need to give so i can execute this programe(I am using window vista). I only know i have to give
    this command some where CommandProg arg1 arg2 arg3 arg4. Output should be
    Output:
    arg1
    arg2
    arg3
    arg4
    Please help me, Thanks in advance.
    Edited by: JayVirk on Dec 30, 2007 11:33 AM

    Jay,
    Your question isn't very clear, hence Joerg's well meaning but irrelevant advise.
    Do you mean:
    I've written a simple program in java which echos
    it's command-line arguments to back to the console.
    Here's my code:
    package forums;
    public class ArgsEchoer
      public static void main(String[] args) {
        for (String arg : args) {
          System.out.println(arg);
    But can't figure out how to compile and run the program.
    I'm using winblows shista, and it's cr@p.
    Please help me, Thanks in advance.So... where are you at? Have you installed the JDK (java development kit)? Which version? Is your path set? Is your classpath set?
    Start here: http://java.sun.com/developer/onlineTraining/new2java/

  • How to add command line arguments to shortcuts in the LV8.5.1 installer

    I want to create multiple shortcuts to my LV program, each with different command line arguments.
    I can do this manually.
    I want the installer to generate these shortcuts.
    I can add different shortcuts in de installer build specification, but I cannot add commandline arguments in the shortcuts.
    Does anyone know how to do this?
    Rindert 

    Hello Forum,
    Does anyone have any better data for this?  I would also like to create an installer using Labview Project Explorer tool (Build Specification->Installer), and I have a need to create some shortcuts to some EXE's (VS.NET built, not LV) which need to have some arguments passed.  I just verified that LV8.6 still does not seem to offer the option of passing arguments when creating shortcuts.  Is this correct?   Creating stub EXE's or batch files isn't a good option for my project, so I'd like to have someone confirm if LV installer tool can't create shortcuts w/ arguments before I fire up InstallShield.
    Regards!

  • How to Pass Command line arguments to an exe created in LV8.0

    Hi Friends,
    I have Created an exe in LV8.0, which accepts the Folder path as input and executes.
    I want to call this exe passing the parameter (i.e folder path in my case)  from the command line argument. How to pass arguments to the exe ?
    Generally we may be having different types of input parameters to a vi like numeric control, string, boolean etc..If we create an exe that needs three input parameters among which one is boolean, other is string and third is a numeric value.
    How to pass these different types of input controls to the exe as parameters in command line at the same time?
    Thanks and Regards,
    SODLB

    I don't have any experience with the 8.x application builder, but the 7.x one has a checkbox for passing the arguments to the executable.
    As for reading them, there should be an example in the example finder (Help>>Find Examples) which shows how to do this. If you want to pass multiple parameters, I suggest you use a structure similar to NAME=VALUE, so that you can parse each element to find the = and then use a case structure to decide what to do with the parameters. This allows your users to enter or not enter any of the switches.
    Try to take over the world!

  • How to pass command line arguments to Web Start appclient?

    Hi,
    I would like to pass arguments to appclient, but "javaws" unable to do that.
    Do I have to overwrite the JNLP? I use Sun Appserver 9.0, it creates JNLP on the fly!!!
    Please help, thanx!
    MB

    Hi, MB.
    If you are talking about the automatic Java Web Start support for launching app clients in GlassFish, you can pass the equivalent of command line arguments using the query string of the URL you use to launch the app client.
    Briefly, use
    http://host:port/client-path?arg=first-arg&arg=second-arg& ...
    specifying the argument values in the order that you want them passed to the client.
    The GlassFish server will do the right thing and generates the correct JNLP so your arguments are passed to the app client.
    The GlassFish developer's guide http://glassfish.dev.java.net/nonav/javaee5/docs/AS91DG.pdf discusses this and all aspects of the Java Web Start support. You can also take a look at this blog entry http://blogs.sun.com/quinn/entry/command_line_arguments_and_properties that focuses on how to pass arguments.
    Since this technique deals with argument passing in the URL, it works no matter how you launch the app client: a URL in a browser, the javaws command, etc.
    - Tim

  • How to count Command-Line Arguments ?

    How do you count Command-Line Arguments ?
    For example,
    java program argument1 arguement2
    I would like to be able to count how many arguements the user inputed
    It should result as 2 for the bold line above
    Thank you for your help

    public static void main(String[] args) {
        int numArgs = args.length; // args holds argument1 and argument2
    }

  • How to pass command line arguments to JWS app

    Hi,
    I want to pass command line arguments to my JWS application. However those arguments are dynamic (eg the username of the user who launched the app) and thus I can not use the argument tag of JNLP file. So what do I need to do in this case?
    Thanks.

    Well, if it's the username on your server systems you should probably include it in the jnlp: can pass it in the url, write once and remove jnlp href attribute, etc.., etc.. (a quick tour of this forum should suffice).
    If it's the OS username you should be able to retrieve it through system properties.
    Whatever it is, passing dynamic arguments means launching javaws through a shell or a shell script (bat if running on windows), so you won't be able to launch through autogenerated desktop and menu shortcuts.
    Anyway, you have two solutions:
    Clean one: associate an extension to your app and write those infos in a file named after that extension.
    Dirty one (always seen it work, but there's no warranty): javaws -open whateverParamYouLike yourAppURL.jnlp, will pass to your main method '-open' as args[0] and '+whateverParamYouLike+' as args[1]. I gotta admin I used it, but I had the most peculiar reason (my app needed another instance on a different JRE aware of being a secondary instance at startup time).
    Bye.
    PS: I'd really love dukes ;-)

  • Slim fails to login...how to get command line back?

    Man, what a drag.  I (seemingly) successfully installed Arch with xfce, which is a huge accomplishment for a guy coming from years of Ubuntu, and avoiding command line and config files every chance he gets.
    Anyway, I'm using slim as a display manager, and it fails to login (I am choosing the xfce session).  I can't seem to get to a command line so that I can try a different display manager.  Google says that Ctrl-Alt-F1 should do the trick, but that just gives me a black screen and sits there.  Any help?
    Thanks.

    Pacopag wrote:I'm not sure how to even edit the grub file.
    Like this http://www.cyberciti.biz/faq/grub-boot- … user-mode/
    Does Alt-Ctrl-F2 work?
    Last edited by karol (2011-05-29 03:39:49)

  • How to get COMMAND LINE input

    I am writng an application to add numbers inputted by the user at the command line in a DOS session in the java application. How do i read in input from the user?
    any help is much appreciated

    import java.io.*;
    public class ReadUser {
          static String userInput;
          static int sum = 0;
       public static void main(String[] args) {
          BufferedReader buff = new BufferedReader(new InputStreamReader (System.in));
          // get a string 4 times
          for (int i=0; i<4; i++) {
              System.out.println("Enter a Number");
              try
                   userInput = buff.readLine();
              catch(Exception ex)
                   System.err.println("Had a problem getting input");
                       // convert the string to an int and total it
              sum = sum + Integer.parseInt(userInput);
          // print the sum
         System.out.println("The total is " + sum);
             System.exit(0);

  • How do SQR command line arguments work?

    Hello,
    I am using sqrw version 8.52.  I would like to run SQR's for testing purposes from the command line with no user intervention.  I found documentation that says I can do something like this:
    "C:\Program Files (x86)\PT85206\bin\sqr\ora\BINW\sqrw" nint268.sqr USERNAME/PASSWORD@DATABASE PARAM1 PARAM2 PARAM3 "-zifC:\users\kramej3\pssqr.ini" "-iC:\Program Files\PT85206\bin\sqr\;C:\temp\sqr_run\;"
    ...where PARAMx is a parameter that is passed to the INPUT statements in the SQR (first PARAM to first INPUT, second to second, etc.)  Unfortunately, it doesn't seem to want to work this way - the parameters are not passed to the program.  Am I doing this right?
    Alternately: is there a version of sqrw that runs as a console application and does not spawn another window to do so?  If I could have sqrw run as a console application, I could get around the parameter requirement by spawning sqrw.exe via a Python script and then attaching to the stdin and stdout file handles.
    Thanks!
    -JK

    See peoplebooks on this subject.
    I believe it is flags before arguments
    PeopleTools 8.52: SQR for PeopleSoft Developers
    Home > PeopleBooks > PeopleTools 8.52: SQR for PeopleSoft Developers > Using the SQR Command Line

  • BSM / audit_syslog ... how to get command line parameters in syslog?

    Hi All!
    I have been experimenting with Sun Basic Security Module (BSM) and was trying to send audit data via syslog to a central logging server like so:
    # cat /etc/security/audit_startup
    /usr/sbin/auditconfig -setpolicy +argv,arge
    # cat /etc/security/audit_control
    plugin: name=audit_syslog.so;p_flags=lo,ex,fr,fc,fd,fw,fmThis does produce the desired log output on the central logging server, except that the log lines do not contain command line parameters / environment variables:
    2008-10-14T15:04:26-06:00 csadm4/csadm4 audit: [ID 702911 audit.notice] execve(2) ok session 1576737601 by rem_adm as root:root in csadm4 from csadm1-16.shell.ca obj /usr/bin/lessAs this makes it pretty useless for keeping proper audit records (there is a difference between
    rm ~/file and
    rm /file that I would like to see) I was wondering if there is a way to customize what is actually produced by audit_syslog.so?
    Thanks in advance,
    Rudolf

    No, your plugin doesn't get any access to the command line.  Look for other methods of IAC (COM, DDE, shared memory, shared file, etc.)

  • How to validate command line arguments

    Hi good programmer.Can anyone help me with this problem.I want want to control my program which accept values from command line,in such a way that when I run it without entering arguments in the command line, it must display message that i must pass argument from command line instead of display the runtime error.
    please help...
    victor

    Then you can check that you have the right number of args and print out a message and exit if you don't
    e.g.
    if (args.length != 2)
    System.out.println("This program needs two arguments");
    return;
    Answer provided by Friends of the Water Cooler. Please inform forum admin via the 'Discuss the JDC Web Site'
    forum that off-topic threads should be supported.

  • Obtaining command line arguments

    Can someone point me at an example of how to obtain command
    line arguments from inside my Flex application? I want to have my
    Flex application perform different tasks when it is launched with
    different command line arguments, for example:
    myApp.exe 1
    myApp.exe 2
    myApp.exe 3
    How is that done in a Flex app?
    TIA,
    Steve

    "plug_in_guy" <[email protected]> wrote in
    message
    news:gnfgf2$ir1$[email protected]..
    > Can someone point me at an example of how to obtain
    command line arguments
    > from
    > inside my Flex application? I want to have my Flex
    application perform
    > different tasks when it is launched with different
    command line arguments,
    > for
    > example:
    >
    > myApp.exe 1
    > myApp.exe 2
    > myApp.exe 3
    >
    > How is that done in a Flex app?
    This may help:
    http://www.davidtucker.net/2008/01/23/air-tip-7-using-command-line-arguments/

  • Can I pass command line arguments to LV6 executables?

    Hi,
    in Document ID: 1CNFGHFI I read that
    "LabVIEW 5.x executables cannot take command line arguments. (...) Support for command line arguments may be available in the next major release of LabVIEW."
    Is that so in LV6? It would be a good reason to update because I'd terribly need it.
    Cheers,
    Daniel

    I am unable to find the original one that Dennis posted. The following is the same, but for LabVIEW 6:
    Getting Command Line Arguments from within a LabVIEW VI
    Regards;
    Enrique
    www.vartortech.com

Maybe you are looking for

  • Application frame not working

    Maybe i'm misunderstanding, but with the application frame checked i thought that when i moved my main image window either by the corner resizing method or dragging the title bar, the entire contents, including the palettes were supposed to move.  Ho

  • X200s: No support for 1920 x 1080

    Hi, I bought an 24" TFT with 1920 x 1080 resolution. I connected it with an VGA-cable to my Ultrabase (docking-station). The Problem now is, that I can Choose the resolution in the Intel Graphics Properties as well as in the Windows (Vista Business 3

  • BAPI_SAG_CHANGE: dump OBJECTS_OBJREF_NOT_ASSIGNED

    Hello, I have just written a custom report that calls BAPI_SAG_CHANGE. It works fine if run in foreground, but if run in background, with the same data, I get a dump: Runtime error OBJECTS_OBJREF_NOT_ASSIGNED Exception     CX_SY_REF_IS_INITIAL Some m

  • External table log and bad files

    Hi, i have defined the following access parameters for my external table and set REJECT LIMIT to 0: ACCESS PARAMETERS RECORDS DELIMITED by NEWLINE BADFILE BAD_DIR:'CARDS.bad' LOGFILE LOG_DIR:'CARDS.log' NODISCARDFILE FIELDS TERMINATED BY "," OPTIONAL

  • Procedure unhappy with order by params

    Good day, I have the following procedure which is working correctly except it is ignoring the "sort" & "dir" params following the order by clause: create or replace PROCEDURE budgets_lookup (p_fields varchar2 default null ,p_query varchar2 default nu