|Skip Navigation Links|
|Exit Print View|
|Oracle GlassFish Server Message Queue 4.5 Administration Guide|
The sample application HelloWorldMessageJNDI is provided for use with this tutorial. It uses the physical destination and administered objects that you created:
A queue physical destination named MyQueueDest
A queue connection factory administered object with JNDI lookup name MyQueueConnectionFactory
A queue administered object with JNDI lookup name MyQueue
The code creates a simple queue sender and receiver, and sends and receives a Hello World message.
Before running the application, open the source file HelloWorldMessageJNDI.java and read through the code. The program is short and amply documented; you should have little trouble understanding how it works.
You should find the file HelloWorldMessageJNDI.class present. (If you make changes to the application, you must recompile it using the procedure for compiling a client application given in the Message Queue Developer’s Guide for Java Clients.)
See the Message Queue Developer’s Guide for Java Clients for information on setting the CLASSPATH variable.
Note - The file jndi.jar is bundled with JDK 1.4. You need not add this file to your CLASSPATH unless you are using an earlier version of the JDK.
On Solaris or Linux:% java HelloWorldMessageJNDI file:///tmp
On Windows:java HelloWorldMessageJNDI
If the application runs successfully, you should see the output shown in Example 2-1.
Example 2-1 Output from Sample Application