Passing Parameters to Non-GUI Applications using jadclient

For details about running the jadclient program to execute a non‑GUI application within your Jade code, see "Running a Non-GUI Client Application using jadclient". (For details about collecting command line arguments into a HugeStringArray that is passed to the initialize method of the application, see "Running a Jade Non-GUI Client Application with Parameters", in the following topic.)

To run a non-GUI application defined in your Jade schema, specify the following arguments in the jadclient program.

jadclient path=database-path
          ini=jade-initialization-file
          schema=schema-name
          app=application-name
          startAppParameters
          [command-line-arguments]

Enclose any command line arguments that contain spaces in double ("") or single ('') quotation marks.

Command line arguments specified after the startAppParameters argument are passed as a HugeStringArray to the initialize method of your application, which must have a signature that contains only an initializeParameter parameter; that is:

method-name(initializeParameter: Object);

An exception is raised if the initialize method does not have one parameter only, of type Object.

If you do not specify any command line arguments, the initialize method signature of your application should not have any parameters. Each argument is limited to the maximum size of a string in a HugeStringArray, which is currently 2047 characters.

The jadclient program treats processing arguments enclosed in double ("") or single ('') quotation marks after the startAppParameters argument as single‑string entries in the HugeStringArray. The handling of strings in this HugeStringArray is application‑specific. For example, dir=program files is treated as a two-string entry and dir="program files" is treated as a one-string entry. How these entries are handled is determined by your application.

The following example shows an Application class initialization method that writes a jadclient command line to the Jade Interpreter Output Viewer.

jadclient(obj: Object);
vars
    cmdLine : HugeStringArray;
    count   : Integer;
begin
    if obj = null then
        write "No command line";
    else
        cmdLine := obj.HugeStringArray;
        foreach count in 1 to cmdLine.size do
            write "Arg[" & count.String & "] = '" & cmdLine[count] & "'";
        endforeach;
    endif;
    terminate;
end;

The following example shows the use of the jadclient program to output six arguments to the Jade Interpreter Output Viewer, based on the Application::jadclient method in the previous example.

c:\jade\bin\jadclient path=c:\jade\system ini=c:\jade\system\jade.ini schema=TestClient app=TestClientA startAppParameters 1 2 three ix "a b" "Second string but not in the violas "

The command line arguments in this example are passed as a HugeStringArray to the Application::jadclient method in the example earlier in this subsection, resulting in the following displayed in the Jade Interpreter Output Viewer.

Arg[1] = '1'
Arg[2] = '2'
Arg[3] = 'three'
Arg[4] = 'ix'
Arg[5] = 'a b'
Arg[6] = 'Second string but not in the violas'

See also "Extracting Schemas as a Non-GUI Application", in Chapter 10 of the Development Environment User's Guide.