Prev | Next

TOC | Index

J2EETM Developer's Guide
Clients


Stand-Alone JavaTM Applications

Previous chapters demonstrate enterprise beans whose clients are stand-alone JavaTM applications. The Getting Started chapter, for example, shows you how to create and run the ConverterClient program, a stand-alone Java application. The ConverterClient program is the client for the ConverterApp J2EE application. When you deploy ConverterApp, you select a checkbox labelled "Return client Jar" and then specify ConverterAppClient.jar. This file contains stub classes enabling the client to communicate with the enterprise bean. You include the ConverterAppClient.jar file in the classpath when running the ConverterClient program:

UNIX:

CPATH=$J2EE_HOME/lib/j2ee.jar:ConverterAppClient.jar:. 
java -classpath "$CPATH" ConverterClient
Windows:

set CPATH=.;%J2EE_HOME%\lib\j2ee.jar;ConverterAppClient.jar 
java -classpath "%CPATH%" ConverterClient
For the previous commands to work, the ConverterClient and the J2EE server hosting the enterprise bean must run on the same machine. If a stand-alone Java application client is to run on a different machine, you must follow these steps:

1. Copy the client .jar file to the same machine where the client program will run.

2. Include the -Dorg.omg.CORBA.ORBInitialHost option when running the client. For example, if your enterprise bean has been deployed on a host named buzz, you would run the client as follows:

UNIX:

CPATH=.:$J2EE_HOME/lib/j2ee.jar:ConverterAppClient.jar
java -Dorg.omg.CORBA.ORBInitialHost=buzz -classpath "$CPATH" 
ConverterClient
Windows:

CPATH=.;%J2EE_HOME%\lib\j2ee.jar;ConverterAppClient.jar 
java -Dorg.omg.CORBA.ORBInitialHost=buzz -classpath "%CPATH%" 
ConverterClient


Prev | Next

TOC | Index


Copyright © 2000 Sun Microsystems, Inc. All rights reserved.