The Java EE 5 Tutorial

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.

Under Admin Username and Admin Password, enter the admin name and password created when you installed the Application Server.

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 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.

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 to javaee.home = C:\\Sun\\AppServer or javaee.home=C:/Sun/AppServer.

Set the javaee.tutorial.home property to the location of your tutorial. This property is used for Ant deployment and undeployment.

For example, on UNIX:

javaee.tutorial.home=/home/username/javaeetutorial5

On Windows:

javaee.tutorial.home=C:/javaeetutorial5

Do not install the tutorial to a location with spaces in the path.

If you did not accept the default values for the admin user and password, set the admin.user property to the value you specified when you installed the Application Server, and set the admin user’s password in the admin-password.txt file in the tut-install/javaeetutorial5/examples/common/ directory to the value you specified when you installed the Application Server.

If you did not use port 8080, set the domain.resources.port property to the value specified when you installed the Application Server.