ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Include rosjava node in a Java project under eclipse

asked 2014-03-19 21:38:23 -0600

Mehdi. gravatar image

updated 2016-10-24 09:08:27 -0600

ngrennan gravatar image

Hello,

I have started using rosjava yesterday and I'm still trying to understand how it really works. After doing some tutorials I was able to connect a Java Listener with a C++ talker (actually very straight forward) Now what I'm trying to do is to put a talker in my Java project under eclipse so that my program can trigger a message sending that will be received by a C++ node which will react to it and make a robot do an action. Any hint where to start? the tutorials I found for integrating rosjava in eclipse are outdated.

Thank you very much

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2014-04-09 16:11:08 -0600

Daniel Stonier gravatar image

Easier way is to just add the 'eclipse' plugin to your root build.gradle file and then run ./gradlew eclipse. It will generate all the eclipse project files you need that can then be imported into eclipse. Eclipse is happy then, so you should be too.

Any time you update the dependencies in the build.gradle in subprojects, you should rerun the ./gradlew eclipse task. This will update the classpaths for eclipse.

An example of my usual workflow:

Then run catkin_make on it to make sure it's all compiling. Source the setup.bash and then go into the rocon_rosjava_core and run the gradle eclipse task.

edit flag offensive delete link more

Comments

Thanks for the answer. At the end I found a much more elegant way to do what I wanted. Rosbridge was enough for my case and works perfectly with a minimal integration effort into my current java project.

Mehdi. gravatar image Mehdi.  ( 2014-04-09 16:24:47 -0600 )edit

Ah, need to improve things then. I suspect some tutorials are mostly what's necessary, but this should be easier for a java person to do than to have to 'bridge' across with a tool that is less capable.

Daniel Stonier gravatar image Daniel Stonier  ( 2014-04-09 17:04:35 -0600 )edit

That is the problem actually I started working with Java (As electrical engineer we mostly use C++) two weeks ago, i didn't create the project I just need to make it able to communicate with ROS.

Mehdi. gravatar image Mehdi.  ( 2014-04-09 18:21:44 -0600 )edit

on version kinetic, you have to enable the plugin on last version by uncommenting " apply plugin: 'eclipse'" in builg.gradle

zoubata gravatar image zoubata  ( 2019-10-29 15:17:52 -0600 )edit
0

answered 2014-03-26 16:07:00 -0600

Mehdi. gravatar image

So my working solution is to just take the org folder under /opt/ros/hydro/share/maven/org and copy it to your eclipse workspace and then include all the libraries(.jar) that are inside in your project. You will also need:

guava version 13+ https://code.google.com/p/guava-libra...

DOMSerializer http://mvnrepository.com/artifact/org...

DNS java: sudo apt-get install libdnsjava-java

netty: http://mvnrepository.com/artifact/org...

Thanks to http://answers.ros.org/users/4920/alb... for the hints

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-03-19 21:38:23 -0600

Seen: 1,704 times

Last updated: Apr 09 '14