how to add external jars to a class in rosjava hydro [closed]
I am trying to modify the Listener.java class in rosjava_tutorial_pubsub to accept a word from a publisher in python and then pass this word to a classifier which is an external jar I want to add to my listener.java class. This is the modified code of the Listener.java:
package 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 {
@Override public GraphName getDefaultNodeName() { return GraphName.of("rosjava_tutorial_pubsub/listener"); }
@Override public void onStart(ConnectedNode connectedNode) { final Log log = connectedNode.getLog();
***final edu.uic.cs.nlp.ros.da.DaClassifier daClassifer = DaClassifier.getInstance();***
Subscriber<std_msgs.String> subscriber =
connectedNode.newSubscriber("chatter", std_msgs.String._TYPE);
subscriber.addMessageListener(new MessageListener<std_msgs.String>() {
@Override
public void onNewMessage(std_msgs.String message) {
***java.lang.String da = daClassifer.classify(message.getData());
log.info("output of the classifier: \"" + da + "\"");***
}
});
} }
Where do I add the classifier's jar as a dependency? I put the jar in the build/install/rosjava_tutorial_pubsub/lib along with the rest of the jars of the package. I also added the following line to my build.gradle:
compile fileTree(dir: 'build/install/rosjava_tutorial_pubsub/lib', include: 'lin.jar')
Is this enough in ros hydro or do i need to make changes in my package.xml as well?