Now you are ready to compile the enterprise bean class (ConverterBean.java) and the servlet class (ConverterServlet.java), and package the compiled classes into a WAR file.
Follow these instructions to build and package the converter example in NetBeans IDE.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to tut-install/examples/ejb/.
Select the converter folder.
Select the Open as Main Project and Open Required Projects check boxes.
Click Open Project.
In the Projects tab, right-click the converter project and select Run. A web browser window will open the URL http://localhost:8080/converter
To compile and package converter using Ant, do the following:
In a terminal window, go to this directory:
tut-install/examples/ejb/converter/ |
Type the following command:
ant all |
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.
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.