Application clients are the client applications that use a servlet
to communicate with an enterprise bean, with the servlet residing on the same
machine as an application server.
About this task
Application clients consist of several models. This topic applies
to application clients based on the Java 2 Platform, Enterprise Edition (J2EE)
model.
A J2EE application client is a Java application program that
accesses enterprise beans, Java DataBase Connectivity (JDBC) application programming
interfaces, and Java Message Service (JMS) message queues. The J2EE application
client program runs on networked client systems. The program follows the same
Java programming model as other Java programs; however, the J2EE application
client depends on the application client run time to configure its execution
environment, and uses the Java Naming and Directory Interface (JNDI) name
space to access resources.
You can use a J2EE application client to
develop an application program, assemble the program into an application client
project, deploy the project as a client application (JAR file), and launch
the client application.
To create a deployable client application,
use an Application Server Toolkit, Rational Application Developer or Rational
Web Developer assembly
tool to create and add an application client project to a new or existing
enterprise application project.
Procedure
- Start an assembly tool.
- If you have not done so already, configure the assembly tool for work on J2EE modules.
Ensure that the J2EE capability is enabled.
- Click File > New > Project > J2EE > Application Client Project
> Next. Or, if you have created a J2EE project before, click File >
New > Application Client Project.
- In the New Application Client Project dialog:
- Name the application client project and specify its location.
To change the default project location, click Browse and specify
a new location. If you specify a non-default project location that is already
being used by another project, you cannot create the project.
- Click Show Advanced to display hidden settings.
- Select the J2EE specification version to which you want your
project to adhere.
- Select a target server. Select the WebSphere
Application Server v6.0 target server to use Version 6 WebSphere Application
Server capabilities.
- If you want to add application client components to an enterprise
application, select Add module to an EAR project.
- Specify a new or existing enterprise archive (EAR) project to
be associated with your new application client project for purposes of deployment.
Select an existing enterprise application project from the drop-down
list or type a new project name. Or, click New and create a new enterprise application. Note that if you type
a new EAR project name, the EAR project is created in the default location
with the lowest compatible J2EE version based on the version of the project
being created. If you want to specify a different version or a different location
for the enterprise application, you must click New and create a new
enterprise application.
- Specify whether you want to create a default Main class.
- Optional: If you are creating a new enterprise application
project or if you have no module dependencies to specify, skip this step.
Otherwise, click Next to specify module and JAR file dependencies.
On the Module Dependencies page, select dependent JAR files or modules
within the associated enterprise application project. This updates the runtime
class-path and Java project build path with the appropriate JAR files. Application
client modules, EJB modules, and Web modules can all have dependencies on
EJB modules or utility JAR files. Modules cannot depend on WAR or application
client JAR files.
- Click Finish.
Results
A new application client project is created, reflecting the J2EE folder
structure that specifies the location of application client content files,
class files, class paths, the deployment descriptor, and supporting metadata.
Files for the application client project are shown in the Project Explorer
view under Enterprise Applications and Application Client Projects.
What to do next
After creating an application client project, you can
edit the application client deployment descriptor if default
properties are not sufficient. In the Client Deployment Descriptor editor,
you can add enterprise bean, resource, or resource environment references
as well as view and edit source code.
For more information, see the online
help for the assembly tool. Similar information is in the Application Server
Toolkit information center available with this information center. Click Application
Server Toolkit > J2EE applications > Defining J2EE application clients.