The Java EE 6 Tutorial

Building, Packaging, Deploying, and Running the address-book Application

This section describes how to build, package, deploy, and run the address-book application. You can do this using either NetBeans IDE or Ant.

ProcedureBuilding, Packaging, Deploying, and Running the address-book Application in NetBeans IDE

  1. In NetBeans IDE, select File->Open Project.

  2. In the Open Project dialog, navigate to:


    tut-install/examples/persistence/
    
  3. Select the address-book folder.

  4. Select the Open as Main Project and Open Required Projects check boxes.

  5. Click Open Project.

  6. In the Projects tab, right-click the address-book project and select Run.

    After the application has been deployed, a web browser window appears at the following URL:


    http://localhost:8080/address-book/
  7. Click Show All Contact Items, then Create New Contact. Type values in the form fields; then click Save.

    If any of the values entered violate the constraints in Contact, an error message will appear in red beside the form field with the incorrect values.

ProcedureBuilding, Packaging, Deploying, and Running the address-book Application Using Ant

  1. In a terminal window, go to:


     
    tut-install/examples/persistence/address-book
    
  2. Type the following command:


    ant
    

    This will compile and assemble the address-book application.

  3. Type the following command:


    ant deploy
    

    This will deploy the application to GlassFish Server.

  4. Open a web browser window and type the following URL:


    http://localhost:8080/address-book/
    

    Tip –

    As a convenience, the all task will build, package, deploy, and run the application. To do this, type the following command:


    ant all
    

  5. Click Show All Contact Items, then Create New Contact. Type values in the form fields; then click Save.

    If any of the values entered violate the constraints in Contact, an error message will appear in red beside the form field with the incorrect values.