The Java EE 6 Tutorial

Building, Packaging, Deploying, and Running the counter Example

The counter example application can be built, deployed, and run using NetBeans IDE or Ant.

ProcedureTo Build, Package, Deploy, and Run the counter Example Using NetBeans IDE

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

  2. In the Open Project dialog, navigate to:


    tut-install/examples/ejb/
    
  3. Select the counter folder.

  4. Select the Open as Main Project check box.

  5. Click Open Project.

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

    A web browser will open the URL http://localhost:8080/counter, which displays the number of hits.

  7. Click the browser’s Refresh button to see the hit count increment.

ProcedureTo Build, Package, Deploy, and Run the counter Example Using Ant

  1. In a terminal window, go to:


    tut-install/examples/ejb/counter
    
  2. Type the following command:


    ant all
    

    This will build and deploy counter to your GlassFish Server instance.

  3. In a web browser, type the following URL:


    http://localhost:8080/counter
    
  4. Click the browser’s Refresh button to see the hit count increment.