This short tutorial demonstrates how to build a simple Java application that uses MQSeries JMS to put a message to a queue. The development environment used is the IBM WebSphere Application Developer Studio (V4.02).
First start WSAD and create a new Java project. We also specify the location of the MQ/JMS JAR files required for building a class.
File -> New -> Project
Select Java and Java Project

Press Next and enter a name for the new project (e.g. My Test JMS Project)

Press Next and select the Libraries tab. In this property page, select the Add External JARs... button. A JAR Selection dialog will appear. Navigate to the folder containing the MQ Java/JMS JAR files from MA88. By default, this will be:
C:\Program Files\IBM\MQSeries\Java\lib
From there, select the following JAR files:
Hold down the control key while clicking each one to make multiple concurrent selections.
Following this, the property page should look like:

Finally, press Finish to create the new project.
Next create a package that will be used to hold your Java classes (e.g. com.me.mytests). You can create a package from the
File -> New ->Java Package
menu option.

At this stage, the project and environment is ready for the application and should look similar to the following (click image for a bigger view):
Now we are ready to code the Java class that performs the work.
From the File -> New -> Java class, create a new class which is part of the project, has a name and contains a main() method.

In the Java source editor, add the following implementation code:
Finally, before running the program, right click the MyTestJMS.java source file in the Packages view and select properties. Supply both the target queue and queue manager as program arguments:

You are now ready to run the application ...
Last Updated: 03/12/2002