how i can find number of messages that are inside a queue?

HiThank you for reading my post.Can some one please let me know how i can find how much messages are inside a queue?Thanks.
[151 byte] By [Legolas.wa] at [2007-11-27 3:30:16]
# 1
imqcmd query bkr -n <queue name> -t torimqcmd list dst
lkschneidera at 2007-7-12 8:33:18 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 2
HiThank you for your reply.I need to do it from within my java application.is there some API to do this?Thanks
Legolas.wa at 2007-7-12 8:33:18 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 3
If you are using < 4.0, no (you will need to exec the command from java)If you are running 4.0 or later, you can do this using the JMX api (see the JMX developers guide)
lkschneidera at 2007-7-12 8:33:18 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...