I built my own package, then I copied in the source form the Publisher/subscriber tutorial (LIstener.java and Talker.java) into the "src" directory. Building works fine, the resulting .class files are located in ../my_package/build/org/ros/tutorials/my_package. I attempt to run the code using this command (after roscore is running of course):
rosrun rosjava_bootstrap run.py my_package org.ros.tutorials.my_package.Listener
However, each time I try to run it, I get the following result:
Buildfile: /home/user/ros_workspace/my_package/dependencies.xml
get-dependencies:
BUILD SUCCESSFUL
Total time: 3 seconds
Executing command: ['java', '-classpath', u'/home/user/ros_workspace/my_package/target/org.ros.rosjava.my_package-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.test_ros-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.roscpp-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.topic_tools-0.0.0.jar:/home/user/ros_workspace/rosjava/apache_xmlrpc/target/org.ros.rosjava.apache-xmlrpc-3.1.3.jar:/home/user/ros_workspace/rosjava/rosjava_bootstrap/target/org.ros.rosjava.rosjava_bootstrap-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.std_msgs-0.0.0.jar:/home/user/ros_workspace/rosjava/rosjava/target/org.ros.rosjava-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.rosgraph_msgs-0.0.0.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.geometry_msgs-0.0.0.jar:/home/user/ros_workspace/rosjava/apache_commons_util/target/org.ros.rosjava.ws-commons-util-1.0.2.jar:/home/user/.ros/rosjava/lib/org.ros.rosjava.sensor_msgs-0.0.0.jar:/home/user/.m2/repository/com/google/guava/org.ros.rosjava.guava/r07/org.ros.rosjava.guava-r07.jar:/home/user/.m2/repository/dnsjava/org.ros.rosjava.dnsjava/2.1.1/org.ros.rosjava.dnsjava-2.1.1.jar:/home/user/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.codec/1.3.0/com.springsource.org.apache.commons.codec-1.3.0.jar:/home/user/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.httpclient/3.1.0/com.springsource.org.apache.commons.httpclient-3.1.0.jar:/home/user/.m2/repository/org/apache/commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar:/home/user/.m2/repository/org/jboss/netty/netty/3.2.4.Final/netty-3.2.4.Final.jar', 'org.ros.RosRun', 'org.ros.tutorials.my_package.Listener']
Loading node class: org.ros.tutorials.my_package.Listener
Unable to locate node: org.ros.tutorials.my_package.Listener
I have no idea how it can not find the Listener.class file since the path is correct. Am I missing something here?
Originally posted by morrowsend on ROS Answers with karma: 56 on 2011-10-05
Post score: 0
Original comments
Comment by damonkohler on 2011-10-08:
Could you please post your solution as an answer and mark it as accepted?
Comment by morrowsend on 2011-10-05:
I got it working. I added the "jar" sections to my build.xml (copied form the pubsub build.xml). Then I had to explicitly build the jar in Eclipse's Ant window. ONce the jar was there, everything went smoothly.
Comment by morrowsend on 2011-10-05:
After posting this, I found a similar topic http://answers.ros.org/question/2121/cant-run-a-ros-package-created-with-rosjava mentioning that a .jar is not being created. This seems to be the case for me as well, even though my manifest.xml has an Export section as mentioned in the ROSJava/build page. I am unsure how to create the jar.