You can certainly do this, the JMS libraries use the MQ libraries so in the end you depend on the base libraries. From a compile stand point if you are running inside an Application Server like websphere you should be able to look up the ConnectionFactory and Queue via JNDI and only compile against the JMS interfaces.
If you are writing an application outside of an application without a JNDI provider its debatable if using the JMS libraries would be better or not - as you will have to configure the ConnectionFactory via the JMS MQ library - tying you to it at compile (versus runtime via JNDI). I'd still use JMS though as the rest of the code can probably just use the JMS interfaces and only setting up the ConnectionFactory would be MQ specific (you might also have to set some MQ specific settings on the Queue depending on the kind of message you want to send).
If you want to send text back and forth use a TextMessage and set on the Queue - queue.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ). If you configure this via JNDI you can avoid all MQ specific code in your classes.
[ September 02, 2008: Message edited by: Tim LeMaster ]