The Java EE 6 Tutorial

Required Software

The following software is required to run the examples:

Java Platform, Standard Edition

To build, deploy, and run the examples, you need a copy of the Java Platform, Standard Edition 6.0 Development Kit (JDK 6). You can download the JDK 6 software from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Download the current JDK update that does not include any other software, such as NetBeans IDE or the Java EE SDK.

Java EE 6 Software Development Kit

GlassFish Server Open Source Edition 3.0.1 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 GlassFish Server and, optionally, NetBeans IDE. To obtain the GlassFish Server, you must install the Java EE 6 Software Development Kit (SDK), which you can download from http://www.oracle.com/technetwork/java/javaee/downloads/index.html. Make sure you download the Java EE 6 SDK, not the Java EE 6 Web Profile SDK.

SDK Installation Tips

During the installation of the SDK, do the following.

This tutorial refers to as-install-parent, the directory where you install the GlassFish Server. For example, the default installation directory on Microsoft Windows is C:\glassfishv3, so as-install-parent is C:\glassfishv3. The GlassFish Server itself is installed in as-install, the glassfish directory under as-install-parent. So on Microsoft Windows, as-install is C:\glassfishv3\glassfish.

After you install the GlassFish Server, add the following directories to your PATH to avoid having to specify the full path when you use commands:

as-install-parent/bin
as-install/bin

Java EE 6 Tutorial Component

The tutorial example source is contained in the tutorial component. To obtain the tutorial component, use the Update Tool.

If you are behind a firewall that prevents you from using the Update Tool to obtain components, you can obtain the tutorial from the java.net web site.

ProcedureTo Obtain the Tutorial Component Using the Update Tool

  1. Start the Update Tool.

    • From the command line, type the command updatetool.

    • On a Windows system, select Start -> All Programs -> Java EE 6 SDK -> Start Update Tool.

  2. Expand the GlassFish Server Open Source Edition node.

  3. Select the Available Add-ons node.

  4. From the list, select the Java EE 6 Tutorial check box.

  5. Click Install.

  6. Accept the license agreement.

    After installation, the Java EE 6 Tutorial appears in the list of installed components. The tool is installed in the as-install/docs/javaee-tutorial directory. This directory contains two subdirectories: docs and examples. The examples directory contains subdirectories for each of the technologies discussed in the tutorial.

Next Steps

Updates to the Java EE 6 Tutorial are published periodically. For details on obtaining these updates, see Getting the Latest Updates to the Tutorial.

ProcedureTo Obtain the Tutorial Component from the java.net Web Site

Follow these steps exactly. If you place the tutorial in the wrong location, the examples will not work.

  1. Open the following URL in a web browser:

    https://javaeetutorial.dev.java.net/

  2. Click the Documents & Files link in the left sidebar.

  3. In the table on the Documents & Files page, locate the latest stable version of the Java EE 6 Tutorial zip file.

  4. Right-click the zip file name and save it to your system.

  5. Copy or move the zip file into the GlassFish SDK directory.

    By default, this directory is named glassfishv3.

  6. Unzip the zip file.

    The tutorial unzips into the directory glassfish/docs/javaee-tutorial.

NetBeans IDE

The NetBeans integrated development environment (IDE) is a free, open-source IDE for developing Java applications, including enterprise applications. NetBeans IDE supports the Java EE platform. You can build, package, deploy, and run the tutorial examples from within NetBeans IDE.

To run the tutorial examples, you need the latest version of NetBeans IDE. You can download NetBeans IDE from http://www.netbeans.org/downloads/index.html.

ProcedureTo Install NetBeans IDE without GlassFish Server

When you install NetBeans IDE, do not install the version of GlassFish Server that comes with NetBeans IDE. To skip the installation of GlassFish Server, follow these steps.

  1. Click Customize on the first page of the NetBeans IDE Installer wizard.

  2. In the Customize Installation dialog, deselect the check box for GlassFish Server and click OK.

  3. Continue with the installation of NetBeans IDE.

ProcedureTo Add GlassFish Server as a Server in NetBeans IDE

To run the tutorial examples in NetBeans IDE, you must add your GlassFish Server as a server in NetBeans IDE. Follow these instructions to add the GlassFish Server to NetBeans IDE.

  1. Select Tools -> Servers to open the Servers dialog.

  2. Click Add Server.

  3. Under Choose Server, select GlassFish v3 and click Next.

  4. Under Server Location, browse the location of your GlassFish Server installation and click Next.

  5. Under Domain Location, select Register Local Domain.

  6. Click Finish.

Apache Ant

Ant is a Java technology-based build tool developed by the Apache Software Foundation (http://ant.apache.org/) and is used to build, package, and deploy the tutorial examples. To run the tutorial examples, you need Ant 1.7.1. If you do not already have Ant 1.7.1, you can install it from the Update Tool that is part of the GlassFish Server.

ProcedureTo Obtain Apache Ant

  1. Start the Update Tool.

    • From the command line, type the command updatetool.

    • On a Windows system, select Start -> All Programs -> Java EE 6 SDK -> Start Update Tool.

  2. Expand the GlassFish Server Open Source Edition node.

  3. Select the Available Add-ons node.

  4. From the list, select the Apache Ant Build Tool check box.

  5. Click Install.

  6. Accept the license agreement.

    After installation, Apache Ant appears in the list of installed components. The tool is installed in the as-install-parent/ant directory.

Next Steps

To use the ant command, add as-install/ant/bin to your PATH environment variable.