Sun GlassFish Message Queue 4.4 Developer's Guide for Java Clients

Setting Up Your Environment

The Message Queue files that need to be used in conjunction with Message Queue Java clients can be found in the lib directory in the installed location for Message Queue on your platform. Message Queue Java clients need to be able to use several .jar files found in the lib directory when these clients are compiled and run.

You need to set the CLASSPATH environment variable when compiling and running a JMS client. (The IMQ_HOME variable, where used, refers to the directory where Message Queue is installed on Windows platforms and on some Sun GlassFish Application Server platforms.)

The value of CLASSPATH depends on the following factors:

The directories where .jar files are stored depends on the installation method, as shown in the following table.

Table 1–1 .jar File Locations

Installation Method 

Directory 

IPS image 

IMQ_HOME/lib/

Solaris™ SVR4 packages 

/usr/share/lib/

Linux RPM packages 

/opt/sun/mq/share/lib/

The table below lists the .jar files you need to compile and run different kinds of code.

Table 1–2 .jar Files Needed in CLASSPATH

Type of Code 

To Compile 

To Run 

Remarks 

JMS client 

jms.jar imq.jar jndi.jar

jms.jar imq.jar jndi.jar

Directory containing compiled Java application or ’.’

See discussion of JNDI .jar files, following this table.

SOAP Client 

saaj-api.jar activation.jar

saaj-api.jar

Directory containing compiled Java application or ’.’

See Chapter 5, Working with SOAP Messages

SOAP Servlet 

jaxm-api.jar saaj-api.jar activation.jar

 

Sun Java System Application Server already includes these .jar files for SOAP servlet support.

Code using SOAP/JMS transformer utilities 

imqxm.jar

.jar files for JMS and SOAP clients

imqxm.jar 

Also add the appropriate .jar files listed in this table for the kind of code you are writing.

A client application must be able to access the file jndi.jar even if the application does not use the Java Naming and Directory Interface (JNDI) directly to look up Message Queue administered objects. This is because JNDI is referenced by the Destination and ConnectionFactory classes.

JNDI .jar files are bundled with JDK 1.4. Thus, if you are using this JDK, you do not have to add jndi.jar to your CLASSPATH setting. However, if you are using an earlier version of the JDK, you must include jndi.jar in your CLASSPATH.

If you are using JNDI to look up Message Queue administered objects, you must also include the following files in your CLASSPATH setting: