0
$\begingroup$

Rosanswers logo

Hello,

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 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: org.ros.RosRun. Program will exit.

Anyone got this tutorial to work, since gradle ?

Thanks for help,


Originally posted by Anas on ROS Answers with karma: 126 on 2012-05-15

Post score: 1


Original comments

Comment by Markus Eich on 2012-05-16:
The same issue here. By the way it seems that only rosjava_tutorial_pubsub is build, not the tutorial_services.

Comment by Gaëtan on 2012-05-16:
same problem too ...

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Markus Eich with karma: 202 on 2012-05-21

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by Anas on 2012-05-22:
thanks it's working

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.

Thanks

Gaëtan


Originally posted by Gaëtan with karma: 56 on 2012-05-20

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Markus Eich on 2012-05-21:
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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.