Good morning,
I would like to create a node for ROS using rosjava so I was testing ros to check that all goes right. To test rosjava, I got the following example from the community:
- start up roscore
- in a terminal, execute: rosrun test_rosjava AddTwoIntsServer
- in another terminal execute: rosrun test_rosjava AddTwoIntsClient 1 2
I executed without any problem roscore but when I execute the second instruction:
rosrun test_rosjava AddTwoIntsServer
I receive the following error:
jabrena@almaFactory:~$ rosrun test_rosjava AddTwoIntsServer
Exception in thread "main" java.lang.NoClassDefFoundError: AddTwoIntsServer
Caused by: java.lang.ClassNotFoundException: AddTwoIntsServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: AddTwoIntsServer. Program will exit.
I was thinking about the problem and I read the area about rosjava: http://www.ros.org/wiki/rosjava
and it says that it necessary to add 2 variables:
LD_LIBRARY_PATH= <rosjava>/bin
LD_PRELOAD="path to libjsig.so"
in my case:
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/opt/ros/diamondback/stacks/client_rosjava/rosjava/bin
export LD_LIBRARY_PATH
export LD_PRELOAD=/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386
When I execute again, I receive another error about LD_PRELOAD:
ERROR: ld.so: object '/usr/lib/jvm/java-6-sun-1.6.0.24/jre/lib/i386/' from LD_PRELOAD cannot be preloaded: ignored.
Exception in thread "main" java.lang.NoClassDefFoundError: AddTwoIntsServer
Caused by: java.lang.ClassNotFoundException: AddTwoIntsServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: AddTwoIntsServer. Program will exit.
Variables related to ROS are:
export
declare -x JAVA_HOME="/usr/lib/jvm/java-6-sun/"
declare -x PATH="/opt/ros/diamondback/ros/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/lejos/bin"
declare -x PYTHONPATH="/opt/ros/diamondback/ros/core/roslib/src:"
declare -x ROS_MASTER_URI="http://localhost:11311"
declare -x ROS_PACKAGE_PATH="/opt/ros/diamondback/stacks"
declare -x ROS_ROOT="/opt/ros/diamondback/ros"
Can you help me?
I would like to run ROS in a right way to create my first node but I need to solve this problem.
Cheers
Originally posted by Juan Antonio Breña Moral on ROS Answers with karma: 274 on 2011-05-01
Post score: 0