The Java EE 5 Tutorial

Editing, Recompiling, Repackaging, and Running the Programs

These steps assume that you have the tutorial installed on only one of the two systems you are using and that you are able to access the file system of jupiter from earth or vice versa.

    After you create the connection factories, edit the source files to specify the new connection factory. Then recompile, repackage, and run the programs. Perform the following steps:

  1. Open the following file in a text editor:

    tut-installjavaeetutorial5/examples/jms/simple/producer/src/java/Producer.java
    
  2. Find the following line:

    @Resource(mappedName="jms/ConnectionFactory")
  3. Change the line to the following:

    @Resource(mappedName="jms/JupiterConnectionFactory")
  4. Recompile and repackage the Producer example on earth.

    If you are using NetBeans IDE, right-click the producer project and choose Clean and Build.

    If you are using Ant, type the following:


    ant
    
  5. Open the following file in a text editor:

    tut-installjavaeetutorial5/examples/jms/simple/synchconsumer/src/java/SynchConsumer.java
    
  6. Repeat steps 2 and 3.

  7. Recompile and repackage the SynchConsumer example on jupiter.

    If you are using NetBeans IDE, right-click the synchconsumer project and choose Clean and Build.

    If you are using Ant, go to the synchconsumer directory and type:


    ant
    
  8. On earth, run Producer. If you are using NetBeans IDE on earth, perform these steps:

    1. Right-click the producer project and choose Properties.

    2. Select Run from the Categories tree.

    3. In the Arguments field, type the following:


      queue 3
      
    4. Click OK.

    5. Right-click the project and choose Run.

      If you are using the appclient command, go to the producer/dist directory and type the following:


      appclient -client producer.jar queue 3
      
  9. On jupiter, run SynchConsumer. If you are using NetBeans IDE on jupiter, perform these steps:

    1. Right-click the synchconsumer project and choose Properties.

    2. Select Run from the Categories tree.

    3. In the Arguments field, type the following:


      queue
      
    4. Click OK.

    5. Right-click the project and choose Run.

      If you are using the appclient command, go to the synchconsumer/dist directory and type the following:


      appclient -client synchconsumer.jar queue
      

For examples showing how to deploy Java EE applications on two different systems, see An Application Example That Consumes Messages from a Remote Server and An Application Example That Deploys a Message-Driven Bean on Two Servers.