background image

Creating the converter Application Client

<< Packaging the converter Example | Invoking a Business Method >>
<< Packaging the converter Example | Invoking a Business Method >>

Creating the converter Application Client

converter-ejb.jar
for the enterprise bean JAR, and converter-war.war for the web client.
The web client in this example requires no compilation. For more information about the Ant
tool, see
"Building the Examples" on page 70
.
Note ­
When compiling the code, the preceding ant task includes the javaee.jar file in the
classpath. This file resides in the lib directory of your Application Server installation. If you
plan to use other tools to compile the source code for Java EE components, make sure that the
classpath includes the javaee.jar file.
Creating the converter Application Client
An application client is a program written in the Java programming language. At runtime, the
client program executes in a different virtual machine than the Application Server. For detailed
information on the appclient command-line tool, see the man page at appclient(1M).
The application client in this example requires two JAR files. The first JAR file is for the Java EE
component of the client. This JAR file contains the client's deployment descriptor and class files;
it is created when you run the New Application Client wizard. Defined by the Java EE
Specification, this JAR file is portable across all compliant application servers.
The second JAR file contains all the classes that are required by the client program at runtime.
These classes enable the client to access the enterprise beans that are running in the Application
Server. The JAR file is retrieved before you run the application. Because this retrieved JAR file is
not covered by the Java EE specification, it is implementation-specific, intended only for the
Application Server.
The application client source code is in the ConverterClient.java file, which is in this
directory:
tut-install/javaeetutorial5/examples/ejb/converter/converter-app-client/src/java/
You compiled this code along with the enterprise bean code in the section
"Compiling and
Packaging the converter Example" on page 647
.
Coding the converter Application Client
The ConverterClient.java source code illustrates the basic tasks performed by the client of an
enterprise bean:
Creating an enterprise bean instance
Invoking a business method
Creating the converter Application Client
The Java EE 5 Tutorial · September 2007
648