Environment variables used by IBM WebSphere MQ classes for JMS

Before you can compile and run IBM® WebSphere® MQ classes for JMS applications, the setting for your CLASSPATH environment variable must include the IBM WebSphere MQ classes for JMS Java archive (JAR) file. Depending on your requirements, you might need to add other JAR files to your class path. To run the scripts provided with IBM WebSphere MQ classes for JMS, other environment variables must be set.

To compile and run IBM WebSphere MQ classes for JMS applications, use the CLASSPATH setting for your platform as shown in Table 1. The setting includes the samples directory, so that you can compile and run the IBM WebSphere MQ classes for JMS sample applications. Alternatively, you can specify the class path on the java command instead of using the environment variable.

Table 1. CLASSPATH setting to compile and run IBM WebSphere MQ classes for JMS applications, including the sample applications
Platform CLASSPATH setting
AIX®
CLASSPATH=MQ_INSTALLATION_PATH/java/lib/com.ibm.mqjms.jar:
MQ_INSTALLATION_PATH/samp/jms:
HP Integrity NonStop Server
CLASSPATH=MQ_INSTALLATION_PATH/java/lib/com.ibm.mqjms.jar:
MQ_INSTALLATION_PATH/samp/jms:
HP-UX, Linux®, and Solaris
CLASSPATH=MQ_INSTALLATION_PATH/java/lib/com.ibm.mqjms.jar:
MQ_INSTALLATION_PATH/samp/jms:
IBM i
CLASSPATH=/QIBM/ProdData/mqm/java/lib/com.ibm.mqjms.jar:
/QIBM/ProdData/mqm/java/samples/jms:
Windows
CLASSPATH=MQ_INSTALLATION_PATH\java\lib\com.ibm.mqjms.jar;
MQ_INSTALLATION_PATH\tools\jms;
z/OS®
CLASSPATH=MQ_INSTALLATION_PATH/mqm/V7R0M0/java/lib/com.ibm.mqjms.jar:
MQ_INSTALLATION_PATH/mqm/V6R0M0/java/samples/jms:

MQ_INSTALLATION_PATH represents the high-level directory in which IBM WebSphere MQ is installed.

The manifest of the JAR file com.ibm.mqjms.jar contains references to most of the other JAR files required by IBM WebSphere MQ classes for JMS applications, and so you do not need to add these JAR files to your class path. These JAR files include those required by applications that use the Java Naming and Directory Interface (JNDI) to retrieve administered objects from a directory service and by applications that use the Java Transaction API (JTA).

However, you must include additional JAR files in your class path in the following circumstances:
  • If you are using channel exit classes that implement the channel exit interfaces defined in the com.ibm.mq package, instead of those defined in the com.ibm.mq.exits package, you must add the IBM WebSphere MQ classes for Java JAR file, com.ibm.mq.jar, to your class path.
  • If you compile your Java code using a Java 2 Software Development Kit (SDK) at Version 1.4.2, you must add the following JAR files to your class path:
    • jms.jar
    • com.ibm.mq.jmqi.jar
    Additionally, if your application uses JNDI to retrieve administered objects from a directory service, you must also add the following JAR files to your class path:
    • fscontext.jar
    • jndi.jar
    • ldap.jar
    • providerutil.jar
    And if your application uses the JTA, you must also add jta.jar to your class path.

    Note that these additional JAR files are required only for compiling your applications, not for running them.

If you compile using the -Xlint option, you might see a message warning you that com.ibm.mq.ese.jar is not present. You can ignore the warning. This file is only present if you have installed the Extended Security Edition.
The scripts provided with IBM WebSphere MQ classes for JMS use the following environment variables:
MQ_JAVA_DATA_PATH
This environment variable specifies the directory for log and trace output.
MQ_JAVA_INSTALL_PATH
This environment variable specifies the directory where WebSphere MQ classes for JMS is installed.
MQ_JAVA_LIB_PATH
This environment variable specifies the directory where the WebSphere MQ classes for JMS libraries are stored, as shown in Table 1.

On Windows, all the environment variables are set automatically during installation. On any other platform, you must set them yourself.

To set the environment variables if you are using a 32-bit JVM on UNIX, HP Integrity NonStop Server, or Linux systems, you can use the script setjmsenv. To set the environment variables if you are using a 64-bit JVM on a UNIX or Linux system, you can use the script setjmsenv64. These scripts are in the MQ_INSTALLATION_PATH/java/bin directory, where MQ_INSTALLATION_PATH represents the high-level directory in which IBM WebSphere MQ is installed.

You can use the setjmsenv or setjmsenv64 script in a variety of ways: You can use it as a basis for setting the required environment variables, as shown in the table, or add them to .profile using a text editor. If you have a non-typical setup, edit the script contents as necessary. Alternatively, you can run the script in every session from which JMS startup scripts are to be run. If you choose this option you need to run the script in every shell window you start, during the JMS verification process by typing . ./setjmsenv or . ./setjmsenv64