ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosjava listener(pub/sub example) error

asked 2011-06-21 21:19:05 -0600

hughie gravatar image

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(
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(
    at org.ros.internal.node.topic.Subscriber$

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();

How can I solve this problem?


edit retag flag offensive close merge delete


That's a pretty strange error. Maybe you should try doing a clean compile?
damonkohler gravatar image damonkohler  ( 2011-06-22 08:32:04 -0600 )edit
Thanks for answer. I cleaned this project. but, It has same error.
hughie gravatar image hughie  ( 2011-06-23 12:19:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-06-27 07:06:26 -0600

damonkohler gravatar image

I tried this myself at the latest revision by doing the following (which worked for me). Please pull the latest version of rosjava and try to get it working like this:

roscd rosjava rosmake ant dist roscore rosrun rosjava run org.ros.tutorials.pubsub.Listener rostopic pub /chatter std_msgs/String -1 "Hello"

edit flag offensive delete link more


Yes, I have pulled latest revision. It is working well. than you.
hughie gravatar image hughie  ( 2011-06-28 00:37:22 -0600 )edit

Question Tools


Asked: 2011-06-21 21:19:05 -0600

Seen: 461 times

Last updated: Jun 27 '11