The J2EETM Tutorial


The Java Tutorial has been an indispensable resource for many programmers learning the Java programming language. This tutorial hopes to serve the same role for developers encountering the Java 2 Platform, Enterprise Edition (J2EE) for the first time. It follows an example-oriented focus similar to the Java Tutorial.

Who Should Use This Tutorial
About the Examples
Related Information
How to Print This Tutorial
Typographical Conventions

Who Should Use This Tutorial

This tutorial is intended for programmers interested in developing and deploying J2EE applications. It covers the main component technologies comprising the J2EE platform and describes how to develop J2EE components and deploy them on the J2EE Software Development Kit (SDK).

This tutorial is not intended for J2EE server or tool vendors. It does not explain how to implement the J2EE architecture, nor does it explain the internals of the J2EE SDK. The J2EE specifications describe the J2EE architecture and can be downloaded from

About the Examples

This tutorial includes many complete, working examples. See Examples for a list of the examples and the chapters where they appear.

Prerequisites for the Examples

To understand the examples, you will need a good knowledge of the Java programming language, SQL, and relational database concepts. The topics in the Java Tutorial listed in Table 1 are particularly relevant:

Table 1 Prerequisite Topics
Java Tutorial

Downloading the Examples

If you are viewing this online and you want to build and run the examples, you need to download the tutorial bundle from

Once you have installed the bundle, the example source code is in the j2eetutorial/examples/src directory, with subdirectories ejb for enterprise bean technology examples, web for Web technology examples, and connector for connector technology examples. For most of the examples, the bundle also includes J2EE application Enterprise Archive EAR files, which are located in the j2eetutorial/examples/ears directory.

How to Build and Run the Examples

This tutorial documents the J2EE SDK version 1.3. To build, deploy, and run the examples you need a copy of the J2EE SDK 1.3 and the Java 2 Platform, Standard Edition (J2SE) SDK 1.3.1 (earlier versions were called JDK). You can download the J2EE SDK from

and the J2SE 1.3.1 from:

The examples are distributed with a configuration file for version 1.3 of ant a portable make tool. The ant utility is hosted by the Jakarta project at the Apache Software Foundation. You can download ant from

To build the tutorial examples:

  1. Download and install the J2SE SDK 1.3.1, J2EE SDK 1.3, and ant.
  2. The installation instructions for the J2SE SDK, J2EE SDK, and ant explain how to set the required environment variables. Verify that the environment variables have been set to the values noted in the Table 1.

    Table 1 Settings for Environment Variables
    Environment Variable
    The location of the J2SE SDK installation.
    The location of the J2EE SDK installation.
    The location of the ant installation.
    Should include the bin directories of the J2EE SDK, J2SE SDK, and ant installations.
  3. Go to the j2eetutorial/examples directory.
  4. Execute ant target. For example, to build all the examples, execute ant all; to build the Web layer examples, execute ant web. The build process deposits the output into the directory j2eetutorial/examples/build.

Related Information

This tutorial provides a concise overview of how to use the central component technologies in the J2EE platform. For more information about these technologies, see the Web sites listed in Table 2

Table 2 Information Sources
Component Technology
Web Site
Enterprise JavaBeans (EJB)
Java Servlet
JavaServer Pages (JSP)

The J2EE platform includes a wide variety of APIs that this tutorial only briefly touches on. Some of these technologies have their own tutorials, which are listed in Table 3.

Table 3 Other Tutorials
Java Message Service (JMS)
Java Naming and Directory Interface (JNDI)
Java API for XML Processing (JAXP)

For complete information on these topics, see the Web sites listed in Table 4.

Table 4 Other Web sites
Web Site
J2EE Connector

Once you have become familiar with the J2EE technologies described in this tutorial, you may be interested in guidelines for architecting J2EE applications. The J2EE BluePrints illustrate best practices for developing and deploying J2EE applications. You can obtain the J2EE BluePrints from

How to Print This Tutorial

To print this tutorial, follow these steps:

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

Typographical Conventions

Table 5 lists the typographical conventions used in this tutorial.

Table 5 Typographical Conventions
Font Style
Emphasis, titles, first occurrence of terms
URLs, code examples, file names, command names, programming language keywords
Italic monospace
Programming variables, variable file names

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


The J2EE tutorial team would like to thank the J2EE SDK team for their technical advice.

We are extremely grateful to the many internal and external reviewers who provided feedback on the tutorial. This helped us to improve the presentation, correct errors, and eliminate bugs.

We would also like to thank our manager, Jim Inscore, for his support and steadying influence.

The chapters on Web components use an example and some material that first appeared in the servlet trail of the Java Tutorial. The chapters on custom tags and the Duke's Bank application use a template tag library that first appeared in the J2EE BluePrints.