Launching Java application clients in the J2EE application client container

The J2EE specification requires support for a client container that runs standalone Java applications (known as J2EE application clients) and provides J2EE services to the applications. J2EE services include naming, security, and resource connections.

Before using the tool

You are ready to run your client application using this tool after you have:

  1. Written the client application program
  2. Assembled and installed an application module (.ear file) in the application server runtime

Invoking the launchClient tool

J2EE application clients are launched using the launchClient shell, located in:

product_installation_root/bin/launchClient.cmd

This command instantiates an instance of the launchClient class.

Application client runtime behavior

The launchClient batch command starts the application client runtime, which:

When your program terminates, the application client runtime cleans up the environment and the Java virtual machine ends.

Passing parameters

You have to pass parameters to the launchClient command. You can pass parameters to your client application program as well. The launchClient command allows you to do both.

The launchClient command requires that the first parameter is either:

All other parameters intended for the launchClient command must begin with the -CC prefix.

Parameters that are not Ear files, or usage requests, or that begin with the -CC prefix, are ignored by the application client runtime, and are passed directly to the client application program.

For more information on the launchClient parameters, refer to the main method in the launchClient javadoc.

launchClient retrieves parameters from three places:

  1. The command line
  2. A properties file
  3. System properties

The parameters are resolved in the order listed above, with command line values having the highest priority and system properties the lowest. This prioritization allows you to set and override default values.

Specifying the server name

By default, the launchClient command uses the environment variable COMPUTERNAME for the BootstrapHost property value. This setting is effective for testing your client application when it is installed on the same computer as the server. However, in other cases you need to override this value with the name of your server.

You can override the BootstrapHost value by invoking launchClient with the following parameters:

launchClient myapp.ear -CCBootstrapHost=abc.midwest.mycompany.com

You can also override the default by specifying the value in a properties file and passing the file name to launchClient.

Running a client application with security enabled

Security is controlled by the server. You do not need to configure security on the client because the client assumes that security is enabled. If security is not enabled, the server ignores the security request, and the client application works as expected.

Format of the launchClient properties file

You can store launchClient values in a properties file, a good method for distributing default values. A knowledgeable user can then override one or more values on the command line.

The format of the file is one launchClient -CC parameter per line without the -CC prefix. For example:

verbose=true
classpath=c:\mydir\util.jar;c:\mydir\harness.jar;c:\production\G19\global.jar
BootstrapHost=abc.westcoast.mycompany.com
tracefile=c:\WebSphere\mylog.txt

Command syntax reference

You can obtain additional help on this command by invoking it without arguments. Following is the result of one such invocation. The arguments are subject to change. For the definitive arguments and syntax, query the program.

IBM WebSphere Application Server, Release 4.0
J2EE Application Client Tool, Version 1.0
Copyright IBM Corp., 1997-2001
WSCL0012I: Processing command line arguments.

Usage: launchClient [<userapp.ear> | -help | -?] [-CC<name>=<value>] [app args]

where:

<userapp.ear>     = The path and name of the Ear file containing the client application.

-help, -?               = Print this help message.

where the -CC properties are for use by the Application Client Runtime:

-CCverbose              = <true|false> Use this option to display additional
                          informational messages. The default is false.
                          
-CCclasspath            = A classpath value. When an application is launched,
                          the system classpath is not used. If you need to
                          access classes that are not in the ear file or part
                          of the resource classpaths, specify the appropriate
                          classpath here. Multiple paths may be concatenated.
                          
-CCjar                  = The name of the client jar file within the EAR file
                          that contains the application you wish to launch.
                          This argument is only necessary when you have
                          multiple client jar files in the ear file.
                          
-CCBootstrapHost        = The name of the host server you wish to connect to
                          initially. Format: your.server.ofchoice.com

-CCBootstrapPort        = The server port number. If not specified, the
                          WebSphere default value is used.

-CCinitonly             = <true|false> This option is intended for ActiveX
                          applications to initialize the Application Client
                          runtime without launching the client application.
                          The default is false.
                          
-CCtrace                = <true|false> Use this option to have WebSphere write
                          debug trace information to a file. You may need this
                          information when reporting a problem to IBM Service.
                          The default is false.
                          
-CCtracefile            = The name of the file to write trace information.
                          The default is to output to the console.
                          
-CCpropfile             = Name of a Properties file containing launchClient
                          properties. In the file, specify the properties
                          without the -CC prefix. For example: verbose=true.
                          
where "app args" are used by the client application and are ignored by
WebSphere.