• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what jar file add to classpath?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When importing javax.jms to java files.What all the jar files do we need to add to the classpath.

Where to get the jar files from?


import javax.jms.*;
import javax.naming.*;
import java.io.*;
import com.servlets.SubscriptionHelper;



public class LoggingRecevier implements MessageListener {

// Print a weather message when it is received
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
TextMessage m = (TextMessage) message;
System.out.println("--- Received log message");
System.out.println(m.getText());
System.out.println("----------");
} else {
System.out.println("Received message of type " +
message.getClass().getName());
}
} catch (JMSException e) {
System.err.println(e.toString());
e.printStackTrace(System.err);
}
}

public static void main(String[] args) {

// Defaults
String tcf = "jms/TopicConnectionFactory";
String topic = "jms/Topic";

// You can override these if you like. First connection
// factory name, then topic name.
if (args.length == 2) {
tcf = args[0];
topic = args[1];
}

// Create a receiver, then set it up to listen for messages
// on the topic. Then wait for messages and print them
// as they come in.
LoggingReceiver wr = new LoggingReceiver();
SubscriptionHelper sh =
new SubscriptionHelper(tcf, topic, wr);

// Wait for publications...
System.out.println("Waiting for publications to topic " + topic);
sh.waitForMessages();
}
}
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It may be that your servlet container is providing servlet.jar, but you need j2ee.jar. The J2EE jars are all in j2ee.jar, but is often broken down to its sub-parts to make it smaller. Add the j2ee.jar to your WEB-INF/lib or go find the jms.jar and add this instead. Either should be fine.
 
Shanthi Mari
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a bunch David.
I added the J2EE to the container.
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic