running rosjava pub/sub tutorial as NodeRunner
Hi there, I took a look at the rosjava https://rosjava.googlecode.com/hg/rosjava_tutorial_pubsub/src/main/java/org/ros/tutorials/pubsub/">pub and sub tutorials today and tried to get them to run through the NodeRunner class.
I thus created the below MyRobot.java file with the main, placed it into the folder with the [Talker|Listener].java files and successfully compiled it.
package org.ros.tutorials.pubsub;
import org.ros.node.NodeRunner;
import com.google.common.base.Preconditions;
import org.ros.node.Node;
import org.ros.node.NodeMain;
import org.ros.node.NodeConfiguration;
import org.ros.node.DefaultNodeRunner;
import org.ros.tutorials.pubsub.Talker;
public class MyRobot
{
public static void main(String[] args)
{
NodeMain nodeMain = new Talker();
// NodeConfiguration nodeConfiguration;
NodeConfiguration nodeConfiguration = NodeConfiguration.newPrivate();
NodeRunner nodeRunner = DefaultNodeRunner.newDefault();
nodeRunner.run(nodeMain, nodeConfiguration);
nodeRunner.shutdown();
}
}
The problem however is that I am now NOT able to successfully execute it. I tried with "java MyRobot" command (in targer/classed folder) but all I am getting back is the following error message:
Exception in thread "main" java.lang.NoClassDefFoundError: MyRobot
Caused by: java.lang.ClassNotFoundException: MyRobot
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: MyRobot. Program will exit.
If anyone could tell me why the class is not being found I'd greatly appreciate it.
best, D.