Hi,
I have downloaded a sample jms program from the below url and try to execute it in my system.But, it shows the below error.Can any one know how to execute the Jms programs in the system.

http://download.oracle.com/javaee/1.4/tutorial/examples/jms/simple/src/SimpleProducer.java

Error:
package javax.jms does not exist

import javax.jms.*;
^
SimpleProducer.java:90: cannot find symbol
symbol  : class ConnectionFactory
location: class SimpleProducer
        ConnectionFactory connectionFactory = null;
        ^
SimpleProducer.java:91: cannot find symbol
symbol  : class Destination
location: class SimpleProducer
        Destination dest = null;
        ^
SimpleProducer.java:94: cannot find symbol
symbol  : class ConnectionFactory
location: class SimpleProducer
            connectionFactory = (ConnectionFactory) jndiContext.lookup(
                                 ^
SimpleProducer.java:96: cannot find symbol
symbol  : class Destination
location: class SimpleProducer
            dest = (Destination) jndiContext.lookup(destName);
                    ^
SimpleProducer.java:112: cannot find symbol
symbol  : class Connection
location: class SimpleProducer
        Connection connection = null;
        ^
SimpleProducer.java:113: cannot find symbol
symbol  : class MessageProducer
location: class SimpleProducer
        MessageProducer producer = null;
        ^
SimpleProducer.java:118: cannot find symbol
symbol  : class Session
location: class SimpleProducer
            Session session =
            ^
SimpleProducer.java:119: cannot find symbol
symbol  : variable Session
location: class SimpleProducer
                connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                                                ^
SimpleProducer.java:122: cannot find symbol
symbol  : class TextMessage
location: class SimpleProducer
            TextMessage message = session.createTextMessage();
            ^
SimpleProducer.java:135: cannot find symbol
symbol  : class JMSException
location: class SimpleProducer
        } catch (JMSException e) {
                 ^
SimpleProducer.java:141: cannot find symbol
symbol  : class JMSException
location: class SimpleProducer
                } catch (JMSException e) {
                         ^

Thank you,

With Regards,
Prem.

Hi musthafa.aj,
Thank you for your help!.I have downloaded the jar file and compiled the program successfully.But when i run the program it displays the below error.

I have taken the program from the below url:
http://download.oracle.com/javaee/1.4/tutorial/examples/jms/simple/src/SimpleSynchConsumer.java

Exception in thread "main" java.lang.NoClassDefFoundError: javax/jms/JMSException
Caused by: java.lang.ClassNotFoundException: javax.jms.JMSException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)

Thank you,

With Regards,
Prem

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.