There are pieces of sample code available in the internet about how to communicate with MQ server using Java. However, you'll find out if you use MQ API, it will not work, always complaining about ClassDefNotFound, even after you include com.ibm.mq.jar and connector.jar in your classpath !!!
In order to resolve such a problem, you need to include com.ibm.mq.jar in the JVM bootstrap entries. It can be easily done using Eclipse!
To get more information about Java class loading mechanism. Here are a couple of interesting entries:
Internals of Java Class Loading
Understanding the Java Classloading Mechanism