The Java EE 6 Tutorial

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

  1. In a terminal window, go to:


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


    ant
    

    This command calls the default target, which builds and packages the application into an EAR file, cart.ear, located in the dist directory.

  3. Type the following command:


    ant deploy
    

    The cart.ear file is deployed to the GlassFish Server.

  4. Type the following command:


    ant run
    

    This task retrieves the application client JAR, cartClient.jar, and runs the application client. The client JAR, cartClient.jar, contains the application client class, the helper class BookException, and the Cart business interface.

    This task is equivalent to running the following command:


    appclient -client cartClient.jar
    

    When you run the client, the application client container injects any component references declared in the application client class, in this case the reference to the Cart enterprise bean.