background image

Building the Examples

<< Starting and Stopping the Java DB Database | Example Directory Structure >>
<< Starting and Stopping the Java DB Database | Example Directory Structure >>

Building the Examples

Building the Examples
The tutorial examples are distributed with a configuration file for either NetBeans IDE or Ant.
Directions for building the examples are provided in each chapter. Either NetBeans IDE or Ant
may be used to build, package, deploy, and run the examples.
Building the Examples Using NetBeans IDE
To run the tutorial examples in NetBeans IDE, you must register your Application Server
installation as a NetBeans Server Instance. Follow these instructions to register the Application
Server in NetBeans IDE.
1. Select Tools
Server Manager to open the Server Manager dialog.
2. Click Add Server.
3. Under Server, select Sun Java System Application Server and click Next.
4. Under Platform Location, enter the location of your Application Server installation.
5. Select Register Local Default Domain and click Next.
6. Under Admin Username and Admin Password, enter the admin name and password
created when you installed the Application Server.
7. Click Finish.
Building the Examples on the Command-Line Using
Ant
Build properties common to all the examples are specified in the build.properties file in the
tut-install/javaeetutorial5/examples/bp-project/ directory. You must create this file
before you can run the examples. Copy the file build.properties.sample to
build.properties
and edit it to reflect your environment. The tutorial examples use the
Java
BluePrints (http://java.sun.com/reference/blueprints/)
build system and application
layout structure.
To run the Ant scripts, you must set common build properties in the file
tut-install/javaeetutorial5/examples/bp-project/build.properties as follows:
Set the javaee.home property to the location of your Application Server installation. The
build process uses the javaee.home property to include the libraries in as-install/lib/ in the
classpath. All examples that run on the Application Server include the Java EE library
archive, as-install/lib/javaee.jar. in the build classpath. Some examples use additional
libraries in as-install/lib/; the required libraries are enumerated in the individual
technology chapters.
Building the Examples
The Java EE 5 Tutorial · September 2007
70