On Mon, Aug 15, 2011 at 10:34 AM, Mark Rowan wrote: > On 15 August 2011 18:07, Ken Conley wrote: >> On Mon, Aug 15, 2011 at 10:00 AM, Mark Rowan wrote: >>> Ok, I've got ant working (thanks to the supplied build.xml on the >>> rosjava wiki page you linked to, although there was a small error in >>> the XML file which I've corrected on the wiki) but I can't seem to >>> find any way to run the compiled classes using rosrun. Is this >>> possible, or do we have to manually execute nodes using java >>> -classpath package.class ? >> >> This is still be tweaked and documentation hasn't been written yet, >> but you can use: >> >> " >> rosrun rosjava_bootstrap run.py  [args ... ] >> " > > Thanks for this info. I assume relates to the ROS package, not > the Java package? Yes > >> That script generally assumes that you are using the tags to >> setup your path.  These tags are currently being finalized >> and you'd have to look at rosjava_core packages for examples. > > My path is currently set manually in .bashrc -- is this a suitable > alternative, or are the tags specifically required? That's fine. The tasks basically let you more easily use other rosjava-based packages (and lets others use yours as well). >> But, the script basically constructs the path from the export tags and runs: >> >> java -classpath org.ros.RosRun [args...] >> >> So that should be fairly similar to what you are used to. > > Thanks. I'm clearly doing something wrong, as run.py responds that it > is 'Unable to locate node'. That means that the is not correct. More thoughts below. > I have a ROS package directory, initialised with rospkg-create, and > containing 'src' and 'build' directories. The 'src' contains a further > Java package directory Running 'ant compile' takes my source and > compiles it into the build directory, at myPackage/MyClass.class . > > Running 'rosrun rosjava_bootstrap run.py > myPackage.MyClass' builds successfully from dependencies.xml (although > it declares an error, "Could not load definitions from resource > net/sf/antcontrib/antlib.xml. It could not be found." -- is this > important?) Don't worry about that error. > but after the execution stage begins, the script returns > "Unable to locate node myPackage.MyClass". > > The huge auto-generated classpath does not include the > /build/ directory, which seems relevant. You can use the: java -classpath org.ros.RosRun [args...] If you wish to keep manually configuring your classpath and the like. If you wish to use run.py instead of manually calling the java RosRun syntax, you need to use the exports. As before, this comes with the caveat that this is where we are currently doing a lot of work on rosjava to stabilize things. Based on your description of your build you will need to: 1) Add a build to your build.xml 2) Add an export to that describes the jar you built, e.g.: The above is using Maven's nomenclature (http://maven.apache.org/): * location: path to directory where your jar file is * artifactId: name of jar file (sans version number and .jar) * version: version number in jar file Thus, the jar file name for the above is target/org.ros.rosjava.ws-commons-util-0.0.0.jar cheers, Ken > Thanks again, and sorry for the many questions! > > Mark > > -- > Mark Rowan  |  http://www.tamias.co.uk > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users >