Ask Your Question

problem running rosjava_tutorial_pubsub

asked 2012-05-15 10:12:09 -0500

Anas gravatar image


I was following the tutorial in rosjava_core, all went smoothly untill I tried to excute the example in rosjava_tutorial_pubsub, in fact, it said in excuting nodes to do

roscore & ./build/rosjava_tutorial_pubsub/bin/rosjava_tutorial_pubsub org.ros.rosjava_tutorial_pubsub.Talker & ./build/rosjava_tutorial_pubsub/bin/rosjava_tutorial_pubsub  org.ros.rosjava_tutorial_pubsub.Listener

First, ./rosjava_tutorial_pubsub dosen't exist in this directory but in build/scripts/rosjava_tutorial_pubsub. Second, when trying

./build/scripts/rosjava_tutorial_pubsub org.ros.rosjava_tutorial_pubsub.Talker

I got this Error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/ros/RosRun Caused by: java.lang.ClassNotFoundException: org.ros.RosRun at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( Could not find the main class: org.ros.RosRun. Program will exit.

Anyone got this tutorial to work, since gradle ?

Thanks for help,

edit retag flag offensive close merge delete


The same issue here. By the way it seems that only rosjava_tutorial_pubsub is build, not the tutorial_services.

Markus Eich gravatar image Markus Eich  ( 2012-05-16 04:21:30 -0500 )edit

same problem too ...

Gaëtan gravatar image Gaëtan  ( 2012-05-16 06:09:40 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2012-05-21 22:08:35 -0500

Markus Eich gravatar image

I managed to run the sample applications. The Tutorial is a bit wrong about the path. Here is how it starts. Make sure you have called gradle installApp in the folder of the tutorial. This will create a folder install in the build folder. THe correct call to the application is

    ./rosjava_tutorial_pubsub/build/install/rosjava_tutorial_pubsub/bin/rosjava_torial_pubsub org.ros.rosjava_tutorial_pubsub.Talker

The same holds for the other tutorials and for self generated apps.

edit flag offensive delete link more


thanks it's working

Anas gravatar image Anas  ( 2012-05-22 04:51:51 -0500 )edit

answered 2012-05-20 22:43:56 -0500

Gaëtan gravatar image

Hi, this is not an answer but I try to solve the same problem.

Here is where I am :

I add in the script : ./build/scripts/rosjava_tutorial_pubsub direct links to the class path : CLASSPATH=$APP_HOME/lib...:...:...:/home/gseverac/Documents/ROS/my_workspaceNewROSJava/rosjava_core/rosjava/bin:/home/gseverac/Documents/ROS/my_workspaceNewROSJava/rosjava_core/rosjava_bootstrap/bin:/usr/share/java

then the program find RosRun.class and RosRuntimeException.class

but now it is looking for com/google/common/collect/Lists :

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/Lists

and I'm stuck there ...

any ideas ? It seams to have a main problem with classpath definition but I don't know how to solve it.



edit flag offensive delete link more


I found out that the generated script "rosjava_tutorial_pub" sets APP_HOME="pwd -P`" and than sets all the classpath to APP_HOME/lib/..... How I understood the build system, all libs are generated in the maven repository, e.g. ~/.m2/repository. Shouldn't the Classpath point to the maven repository?

Markus Eich gravatar image Markus Eich  ( 2012-05-21 03:37:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2012-05-15 10:12:09 -0500

Seen: 1,034 times

Last updated: May 21 '12