Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
Section 8. Example 1: Compiling and packaging your
application
Compiling and packaging your application
Now that I have shown all the code to the CMP enabled entity bean, let s look at how to
package and actually deploy it. To facilitate deployment, I have created an Ant build
script that does the following:
compiles all of the source code
packages the enterprise beans into two
.jar
files: one for the session bean
(
userMgmt.jar
) and one for all of the entities (
userEntity.jar
)
packages the client code into a
.jar
file (
client userMgmt.jar
)
Uses SQL DDL to create sample database tables
Packages the
.jar
files into an
.ear
file (
app.ear
)
Note that an
.ear
file is an Enterprise Archive file. Basically it is a file that can contain
other
.jar
files and
.war
files.
Ear
files can be read and processed by using the version
of
deploytool
that ships with the reference implementation.
The to compile and package your application you will need to setup your environment.
Setup you environment as follows:
set USR_ROOT=c:
set JAVA_HOME=%USR_ROOT%\jdk1.3
set J2EE_HOME=%USR_ROOT%\j2sdkee1.3
set ANT_HOME=%USR_ROOT%\tools\Ant
PATH=%PATH%;%ANT_HOME%\bin;%J2EE_HOME%\bin
The above example assumes you are using a Windows box and that you have installed
the Java SDK in
c:\jdk1.3
, the J2EE SDK in
c:\j2sdkee1.3
and that you have installed
the Ant build application in
c:\tools\ant
. Create a batch file similar to the one listed
above and adjust the directory location accordingly. Modification will have to be made
for developers on other platforms. (I expect any Unix jocks to translate the above easily
into thier shell script of choice so I wont insult thier intelligence by adding directions.)
Deploying your application with
deploytool
To run the Ant build script go to cmpCmr/seciton2 and type
ant package
on the
command prompt. Using Ant with no arguments will display a message describing all of
Introducing EJB CMP/CMR, Part 1 of 2
Page 31 of 48






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

tomcat web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved