listener rosjava [closed]

asked 2013-12-27 16:23:11 -0500

uzair gravatar image

updated 2013-12-27 19:21:42 -0500

tfoote gravatar image

I am trying to build a listener in rosjava. I used the code found at the rosjava core snapshot documentation and changed the GraphName() to GraphNmae.of(). I also added these lines to the code:

package com.github.rosjava.dude.Listener;(The name of my project is dude as it was given in the tutorial)

import org.ros.rosjava_tutorial_pubsub;

When I build this using catkin_make , I get two errors. THe errors and the code is given below. Can somebody please help me fix this. THanks a ton.

1st error:

/home/uahmed9/rosjava/src/rosjava_foo/dude/src/main/java/com/github/rosjava/dude/ cannot find symbol symbol : class rosjava_tutorial_pubsub location: package org.ros import org.ros.rosjava_tutorial_pubsub;

The dot between ros and rosjava in the import statement is creating error.

2nd error:

/home/uahmed9/rosjava/src/rosjava_foo/dude/src/main/java/com/github/rosjava/dude/ cannot find symbol symbol : class of location: class org.ros.namespace.GraphName return new GraphName.of("rosjava_tutorial_pubsub/listener");

The dot between GraphName and of in the import statement is creating error. The Code:

package com.github.rosjava.dude.Listener;

import org.ros.rosjava_tutorial_pubsub;

import org.apache.commons.logging.Log;

import org.ros.message.MessageListener;

import org.ros.namespace.GraphName;

import org.ros.node.AbstractNodeMain;

import org.ros.node.ConnectedNode;

import org.ros.node.NodeMain;

import org.ros.node.topic.Subscriber;

public class Listener extends AbstractNodeMain {


public GraphName getDefaultNodeName() {

return new GraphName.of("rosjava_tutorial_pubsub/listener");



public void onStart(ConnectedNode connectedNode) {

final Log log = connectedNode.getLog();

Subscriber<std_msgs.String> subscriber = connectedNode.newSubscriber("chatter",


subscriber.addMessageListener(new MessageListener<std_msgs.String>() {


  public void onNewMessage(std_msgs.String message) {"I heard: \"" + message.getData() + "\"");





edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tfoote
close date 2013-12-27 19:22:00

Comments Duplicate

tfoote gravatar image tfoote  ( 2013-12-27 19:21:57 -0500 )edit

u closed all the questions? can you reopen one of the duplicate questions? i dont know how it got posted so many times.

uzair gravatar image uzair  ( 2013-12-28 09:23:00 -0500 )edit

No I closed all duplicates except the one I linked to.

tfoote gravatar image tfoote  ( 2013-12-28 10:44:50 -0500 )edit


uzair gravatar image uzair  ( 2013-12-28 11:04:54 -0500 )edit