The JavaTrademarked EE 5 Tutorial is a guide to developing enterprise applications for the Java Platform, Enterprise Edition 5 (Java EE 5). Here we cover all the things you need to know to make the best use of this tutorial.

Who Should Use This Tutorial

This tutorial is intended for programmers who are interested in developing and deploying Java EE 5 applications on the Sun Java System Application Server Platform Edition 9.


Before proceeding with this tutorial you should have a good knowledge of the Java programming language. A good way to get to that point is to work through all the basic and some of the specialized trails in The JavaTrademarked Tutorial, Mary Campione et al., (Addison-Wesley, 2000). In particular, you should be familiar with relational database and security features described in the trails listed in Table 1.

Table 1 Prerequisite Trails in The JavaTrademarked Tutorial 

How to Read This Tutorial

The Java EE 5 platform is quite large, and this tutorial reflects this. However, you don't have to digest everything in it at once. The tutorial has been divided into parts to help you navigate the content more easily.

This tutorial opens with an introductory chapter, which you should read before proceeding to any specific technology area. Chapter 1 covers the Java EE 5 platform architecture and APIs along with the Sun Java System Application Server Platform Edition 9.

When you have digested the basics, you can delve into one or more of the five main technology areas listed next. Because there are dependencies between some of the chapters, Figure 1 contains a roadmap for navigating through the tutorial.

Roadmap to This Tutorial

Figure 1 Roadmap to This Tutorial

After you have become familiar with some of the technology areas, you are ready to tackle the case studies, which tie together several of the technologies discussed in the tutorial. The Coffee Break Application (Chapter 37) describes an application that uses the web application and web services APIs. The Duke's Bank Application (Chapter 38) describes an application that employs web application technologies, enterprise beans, and the Java Persistence API.

Finally, the appendix contains auxiliary information helpful to the Java EE 5 application developer:

About the Examples

This section tells you everything you need to know to install, build, and run the examples.

Required Software

The following software is required to run the examples.

Tutorial Bundle

The tutorial example source is contained in the tutorial bundle. If you are viewing this online, you need to click on the "Download" link at the top of any page.

After you have installed the tutorial bundle, the example source code is in the <INSTALL>/javaee5tutorial/examples/ directory, with subdirectories for each of the technologies discussed in the tutorial.

Application Server

The Sun Java System Application Server Platform Edition 9 is targeted as the build and runtime environment for the tutorial examples. To build, deploy, and run the examples, you need a copy of the Application Server and Java 2 Platform, Standard Edition 5.0 (J2SE 5.0). If you already have a copy of the J2SE SDK, you can download the Application Server from: 

You can also download the Java EE 5 SDK--which contains the Application Server and the J2SE SDK--from the same site.

Application Server Installation Tips

In the Admin configuration pane of the Application Server installer,

In the Installation Options pane, check the Add Bin Directory to PATH checkbox so that Application Server scripts (asadmin, asant, wsimport, wsgen, xjc, and schemagen) override other installations.

Apache Ant

Ant is a Java technology-based build tool developed by the Apache Software Foundation (, and is used to build, package, and deploy the tutorial examples. Ant is included with the Application Server. To use the ant command-line tool add <JAVAEE_HOME>/lib/ant/bin to your PATH environment variable.

Registry Server

You need a registry server to run the examples discussed in Chapter 19. Instructions for obtaining and setting up a registry server are provided in Chapter 19.

Building the Examples

The tutorial examples are distributed with a configuration file for ant or asant, a portable build tool contained in the Application Server. This tool is an extension of the Ant tool developed by the Apache Software Foundation ( The asant utility contains additional tasks that invoke the Application Server administration utility asadmin. Directions for building the examples are provided in each chapter. Either ant or asant may be used to build, package, and deploy the examples.

Build properties common to all the examples are specified in the <INSTALL>/javaeetutorial5/examples/bp-project/ file. This file must be created before you run the examples. We've included a sample file <INSTALL>/javaeetutorial5/examples/bp-project/ that you should rename to <INSTALL>/javaeetutorial5/examples/bp-project/ and edit to reflect your environment. The tutorial examples use the Java BluePrints ( build system and application layout structure.

To run the ant scripts, you must set common build properties in the file <INSTALL>/javaeetutorial5/examples/bp-project/ as follows:

Note: On Windows, you must escape any backslashes in the javaee.home property with another backslash or use forward slashes as a path separator. So, if your Application Server installation is C:\Sun\AppServer, you must set javaee.home as follows:

javaee.home = C:\\Sun\\AppServer



Tutorial Example Directory Structure

To facilitate iterative development and keep application source separate from compiled files the tutorial examples use the Java BluePrints application directory structure.

Each application module has the following structure:

Examples that have multiple application modules packaged into an enterprise application archive (or EAR) have submodule directories that use the following naming conventions:

The Ant build files (build.xml) distributed with the examples contain targets to create a build subdirectory and to copy and compile files into that directory; a dist subdirectory, which holds the packaged module file; and a client-jar directory, which holds the retrieved application client JAR.

Further Information

This tutorial includes the basic information that you need to deploy applications on and administer the Application Server.

See the Sun JavaTrademarked System Application Server Platform Edition 9 Developer's Guide at for information about developer features of the Application Server.

See the Sun JavaTrademarked System Application Server Platform Edition 9 Administration Guide at for information about administering the Application Server.

For information about the Java DB database included with the Application Server see the Apache web site at

How to Print This Tutorial

To print this tutorial, follow these steps:

  1. Ensure that Adobe Acrobat Reader is installed on your system.
  2. Open the PDF version of this book.
  3. Click the printer icon in Adobe Acrobat Reader.

Typographical Conventions

Table 2 lists the typographical conventions used in this tutorial.

Table 2 Typographical Conventions
Font Style
Emphasis, titles, first occurrence of terms
URLs, code examples, file names, path names, tool names, application names, programming language keywords, tag, interface, class, method, and field names, properties
italic monospace
Variables in code, file paths, and URLs
<italic monospace>
User-selected file path components

Menu selections indicated with the right-arrow character Right Arrow, for example, FirstRight ArrowSecond, should be interpreted as: select the First menu, then choose Second from the First submenu.


To send comments, broken link reports, errors, suggestions, and questions about this tutorial to the tutorial team, please use the feedback form at