i need it to be done through stand alone client. i mean its pure java class which contains main method from there i want to post message to queue running in MQServer.
how to create a connection factory from context just like the way you have given reply
This code is looking up the JMS object in a JNDI context. What you need to a JNDI provider ( you could even use the Sun reference ones I guess, and check out the JNDI tutorial while you're at it ) and then bind your queueing objects into the JNDI context, and access the JNDI context. The JMS provider you have will probably have a tool for binding its objects into JNDI, for example WebSphere MQ has JMSAdmin, or you could do it via an app server. You'll have to provide the correct properties for your app to access the JNDI context, typically in a JNDI.properties file in your classpath. The relevent properties are typically the initial context factory class name, the protocol, host and the port. The MQ tool will have to use the same JNDI context.
If your set up is WebSphere MQ inside WebSphere ( I'm guessing its this because of the forum youre in ) then you could run your application with the launchclient batch file. This provides the correct environment for you so you wouldn't need to specify the JNDI initial context factory etc. [ March 27, 2007: Message edited by: Steve Wink ]