Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rosjava listener(pub/sub example) error

Hi, I am trying to Listening the Hello message by rosjava(pure java) client. The error is occured, when received a message from publisher. I ran roscore(not in rosjava) and I sent the message by rostopic pub /chatter std_msgs/String -1 "Hello".

    Jun 22, 2011 5:00:10 PM org.ros.internal.node.RosoutLogger info
INFO: I heard: "Hello"
Exception in thread "Thread-4" java.lang.NoSuchMethodError: org.ros.Publisher.publish(Lorg/ros/message/Message;)V
    at org.ros.internal.node.RosoutLogger.publishToRosout(RosoutLogger.java:64)
    at org.ros.internal.node.RosoutLogger.info(RosoutLogger.java:139)
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(Listener.java:45)
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(Listener.java:42)
    at org.ros.internal.node.topic.Subscriber$MessageReadingThread.run(Subscriber.java:85)

client source is as below.

import org.ros.NodeConfiguration;
import org.ros.tutorials.pubsub.*;

public class ROS_Listener {
        public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("Hello - Listener");

        org.ros.NodeConfiguration node_cfg = org.ros.NodeConfiguration.createDefault();
        org.ros.tutorials.pubsub.Listener ros_listener = new org.ros.tutorials.pubsub.Listener();
        ros_listener.main(node_cfg);
      }
    }

How can I solve this problem?

Thanks.