Rosanswers logo

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

How can I solve this problem?


Originally posted by hughie on ROS Answers with karma: 71 on 2011-06-21

Post score: 1

Original comments

Comment by hughie on 2011-06-23:
Thanks for answer. I cleaned this project. but, It has same error.

Comment by damonkohler on 2011-06-22:
That's a pretty strange error. Maybe you should try doing a clean compile?


1 Answer 1


Rosanswers logo

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"

Originally posted by damonkohler with karma: 3838 on 2011-06-27

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by hughie on 2011-06-28:
Yes, I have pulled latest revision. It is working well. than you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.