Here's a tutorial that may help:
Also, be sure to use the docs for the right version of WMQ. V7.0 is current and v6.0 is supported until September 2011. Whichever you are using, look at the Using Java manual for the right version:
v6.0 manual
v7.0 manual