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

Launch the rosjava application with the ROS Melodic version. Which method/tutorial is correct?

asked 2019-07-22 08:21:27 -0500

Dines gravatar image

updated 2019-07-29 11:04:57 -0500

Hello. I want to develop a ROS application. I need to use Java for this. As I understand it, there is a rosjava package. But I also need to use a version of ros melodic but rosjava has not yet been ported to this version, so the deb installation is not available. There are two options left for me, as I understand from this page . Besides this page, I also saw and . It seems to me that I have tried all the methods of installing rosjava as well as creating and running the rosjava application. Nothing I tried helped me. There was always some mistake. So I think I need to ask this. How do I install rosjava, create an application and run it? Which path is the right one? I don't need rosrun or roslaunch for my purposes. I have to write this in java. Essentially, apart from the ros features, it should be a classic Java application with a standard maven structure and build using gradle. And have the main features that ROS provides for other languages (Message publish and subscribe, services and etc. ). I would like to provide an error message but because of several different installation methods I don't understand what is important and what is not (and what I do). I want to repeat that this application may not be a standard ros package. But I would like to see a standard java application with just ros functions. Maybe you can do it purely in Gradle? That would be great, I suppose.

P.S. Sorry about the bad English P.P.S. I'm sorry about the bad statement of the problem. I'm just tired and I don't know what I'm doing.

env | grep ROS

cat /proc/version
Linux version 4.18.0-25-generic (buildd@lgw01-amd64-033) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019


java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

Edit 2:Update links: One of the methods I tried to follow. The old link stopped working

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-25 14:11:07 -0500

jubeira gravatar image

Hi @Dines,

Try installing rosjava from source: If you find an error when getting dependencies (rosdep install step), use -r option to continue and don't worry.

You should be able to build applications with catkin_make or with Gradle directly if you don't need any custom messages. If you want to define your own interfaces (messages / services) you should create a catkin package and apply the same CMake rules you usually would with a regular roscpp or rospy package.

Hope it helps!

edit flag offensive delete link more


Well, I tried to do what it says. The first time I built it, it was a mistake. I didn't read it in detail, but as far as I understood it took too long to build and gradle/java gave me the error. So I tried to run the build several more times. Each time the number of errors decreased. After a few builds the error stopped changing and became this . [Fatal Error] package.xml:1:7: The string "--" is not permitted within comments. This line has already occurred to me in other build methods described in other sources. Can you help me?

Dines gravatar image Dines  ( 2019-07-29 09:04:54 -0500 )edit

I've never seen an error like that one. The catkin plugin apparently failing is this one:; I don't see the -- anywhere. Can you try building rosjava core with gradle directly? Go to rosjava_core folder and run ./gradlew build.

jubeira gravatar image jubeira  ( 2019-07-29 09:18:53 -0500 )edit The same error occurs when trying to follow the instructions described here

Dines gravatar image Dines  ( 2019-07-29 11:02:04 -0500 )edit

What do you think I should do? Write about it in the issue on github or ask on this resource? Two different installation methods and the same problem. Thanks for your help anyway.

Dines gravatar image Dines  ( 2019-07-30 18:05:52 -0500 )edit

It's a bit hard to tell. The pastebin says failed to apply plugin catkin. Try commenting / deleting that line from build.gradle and build using rosjava_core using gradlew (change the version number in allprojects block as well to the version in package.xml manually as well). Also, try using --stacktrace and --debug options when building to get more information.

jubeira gravatar image jubeira  ( 2019-07-31 08:31:46 -0500 )edit

Question Tools



Asked: 2019-07-22 08:21:27 -0500

Seen: 967 times

Last updated: Jul 29 '19