The Java EE 6 Tutorial, Volume I

Compiling, Packaging, and Running the converter Example Using Ant

    To compile and package converter using Ant, do the following:

  1. In a terminal window, go to this directory:


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


    ant all
    
  3. Open a web browser to the following URL:


    http://localhost:8080/converter

This command calls the default task, which compiles the source files for the enterprise bean and the servlet, placing the class files in the build subdirectory (not the src directory) of the project. The default task packages the project into a WAR module: converter.war. For more information about the Ant tool, see Building the Examples.


Note –

When compiling the code, the preceding ant task includes the Java EE API JAR files in the classpath. These JARs reside in the modules directory of your Enterprise Server installation. If you plan to use other tools to compile the source code for Java EE components, make sure that the classpath includes the Java EE API JAR files.


After entering 100 in the input field and clicking Submit, you should see the screen shown in Figure 15–1.

Figure 15–1 converter Web Client

Screenshot showing the converter web client.