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

Similar Messages

  • 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 ;-)

  • 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 parameters During server start up

    Hi,
      I am trying to use Net Beans profiling tool.On the server side i required to pass a command line option to enable remote profiling.
    Regards,
    Kiran.

    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 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 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 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 options to app using the "open" command?

    I am using jedit, and since I'm doing a lot of stuff in a shell, I'd really like to launch it from the command line as though I'd opened from finder, so I wrote a script that contains this:
    open -a /Applications/Jedit.app "$@" &
    This works well for everything except NEW files, where I get this error:
    2007-02-16 19:29:48.072 open[1032] No such file: /Users/millerti/projects/ateon/new_file
    Is there a way I can override this?
    So, it occurred to me that I might try running jedit directly this way:
    /Applications/Jedit.app/Contents/MacOS/jedit -- "$@" &
    The trouble is that this suffers all sorts of weird problems. For instance, if there's already a jedit running, it launches another one (despite the fact that -server is default). Moreover, the file it opens, existing or not, is not the one I specify. If I'm in ~/mydir and I open ./myfile, jedit opens instead /Applications/myfile.
    Obviously, I'm doing something wrong. Can someone help me figure out what open is doing internally so that I can launch jedit compatible with how open does it so that I can both open existing files and create new ones the same way from the command line?
    BTW, I can make more complex script.
    Also, if this isn't the right forum for this, can someone tell me where would be a better place to get the question answered?
    And I'm not expecting to get jedit support here. This isn't a jedit problem because it's behaving correctly.
    Thanks.

    Applications rarely take command line arguments. I don't know anything about Jedit, whether that is an exception, but you are not sending an argument to Jedit with the open command. The file name on your command line is an argument to the open command. The open command says "open this file with the specified application". The application doesn't see the argument. It sees the file exactly as if it were opened from the Finder. That's why naming a non-existent file doesn't work.
    What if you open Jedit with no file, create a new document in the application. (Again, I am not familiar with Jedit.)

  • 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
    }

  • 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

  • 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".

  • 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.

  • 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

  • Passing command line argument in java

    I was writting a calendar pogram that took user input from the command line. What I want to know is how can I write my program so that if the user doesn't enter the info. it will automatically assign a value to the variable in the array, eg:
    if they typed: java calendarmonth 10 2005
    they would get a printout for the calendar month of October 2005, but I want it so that if they typed
    java calendarmonth 10
    it would automatically assign they year to be the current year, and if they typed
    java calendarmonth
    it would auctomattically assign the current month and year to the program, heres the source code:
    import javax.swing.JOptionPane;
    import java.util.*;
    public class calendarmonth {
         /** Main method */
         public static void main(String argv[]) {
              String monthString = argv[0];
              int month = Integer.parseInt(monthString);
              String yearString = argv[1];
              int year = Integer.parseInt(yearString);
              printMonth(year, month);
              if (month > 12) {
              System.out.println("Invalid Number Please Try");
         //code to perform OK action
              /** Print the calendar for a month in a year */
              static void printMonth(int year, int month) {
                   //Print the heading of the calendar
                   printMonthTitle(year, month);
                   //Print the headings of the calendar
                   printMonthBody(year, month);
              /** Print the month title, e.g., May, 1999 */
              static void printMonthTitle(int year, int month) {
                   System.out.println(" " + getMonthName(month)
                   + " " + year);
                   System.out.println("------------------------------");
                   System.out.println(" Sun Mon Tue Wed Thu Fri Sat");
                   /** Get the English name for the month */
                   static String getMonthName(int month) {
                        String monthName = null;
                        switch (month) {
                             case 1: monthName = "January"; break;
                             case 2: monthName = "February"; break;
                             case 3: monthName = "March"; break;
                             case 4: monthName = "April"; break;
                             case 5: monthName = "May"; break;
                             case 6: monthName = "June"; break;
                             case 7: monthName = "July"; break;
                             case 8: monthName = "August"; break;
                             case 9: monthName = "September"; break;
                             case 10: monthName = "October"; break;
                             case 11: monthName = "November"; break;
                             case 12: monthName = "December"; break;
                        return monthName;
    /** Print month body*/
    static void printMonthBody(int year, int month){
    //Get start day of the week for the first date in the month
    int startDay = getStartDay(year, month);
    //Get number of days in the month
    int numberOfDaysInMonth = getNumberOfDaysInMonth(year, month);
    //Pad space before the first day of the month
    int i = 0;
    for (i = 0; i < startDay; i++)
         System.out.print(" ");
    for (i = 1; i <= numberOfDaysInMonth; i++) {
    if (i < 10)
    System.out.print(" " + i);
    else
    System.out.print(" " + i);
    if ((i + startDay) % 7 == 0)
         System.out.println();
         System.out.println();
    /** Get the start day of the first day in a month */
    static int getStartDay(int year, int month) {
    //Get total number of days since 1/1/1800
    int startDay1800 = 3;
    int totalNumberOfDays = getTotalNumberOfDays(year, month);
    //Return the start day
    return (totalNumberOfDays + startDay1800) % 7;
    /** Get the total number of days since Jan 1, 1800 */
    static int getTotalNumberOfDays(int year, int month) {
    int total = 0;
    // Get the total days from 1800 to year - 1
    for (int i = 1800; i < year; i++)
    if (isLeapYear(i))
    total = total + 366;
    else
    total = total + 365;
    // Add days from Jan to the month prior to the calendar month
    for (int i = 1; i < month; i++)
    total = total + getNumberOfDaysInMonth(year, i);
    return total;
    /** Get the number of days in a month */
    static int getNumberOfDaysInMonth(int year, int month) {
    if (month == 1 || month == 3 || month == 5 || month == 7 ||
    month == 8 || month == 10 || month == 12)
    return 31;
    if (month == 4 || month == 6 || month == 9 || month == 11)
    return 30;
    if (month == 2) return isLeapYear(year) ? 29 : 28;
    return 0; // If month is incorrect
    thanks
    /** Determine if it is a leap year */
    static boolean isLeapYear(int year) {
    return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
    }

    hey smallsouljah , to use code tags just put your code inside code tags.
    to create code tags you just need to press the button code that is located bellow the subject, this will automatically create code tags.
    System.out.println("testing");
    try yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to pass command line parameters in calling ant file

    Hi All, I m using a Build file which calls another build file.
    That build file is run from the command prompt by give ant -lib <path of jars it needs for executing>.
    Now i m calling this file from main build file but it does not work as i m not able to set <b>-lib </b>.
    Pls can anybody let me know how to set such command line parameters to call the build file in ant script.
    Thanks in Advance.
    Ketan.B.Parekh

    Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
    Another option is to use external tables
    Re: Data Loading
    Message was edited by:
    Jens Petersen

Maybe you are looking for