Ask Your Question

Is jni supported in roscpp indigo?

asked 2016-02-10 02:43:43 -0500

Yael Green gravatar image

I am writing a node in C++ which communicates with Java code. I think the most elegant way to do this is by using JNI. Is jni supported in roscpp indego? Can anyone point me to a tutorial or example?


edit retag flag offensive close merge delete


Can you be a bit more specific? In what way do you think that roscpp should 'support jni'? I'd expect that if a typical C/C++ program can call into Java through JNI, a ROS node should be able to do the same.

gvdhoorn gravatar image gvdhoorn  ( 2016-02-10 08:12:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-13 05:55:14 -0500

Yael Green gravatar image

JNI is supported since my code is writen in C++. To get it to work I added to the CMakeLists:

set(CMAKE_CXX_FLAGS "-L /usr/java/jdk1.7.0_79/jre/lib/amd64/server/ -I /usr/java/jdk1.7.0_79/include/ -I /usr/java/jdk1.7.0_79/include/linux/ -ljvm -std=c++0x")

SET(CMAKE_CXX_COMPILER "/usr/bin/g++") set(JAVA_COMPILE "/usr/java/jdk1.7.0_79/bin")

find_package(Java REQUIRED) find_package(JNI REQUIRED)



edit flag offensive delete link more

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: 2016-02-10 02:43:43 -0500

Seen: 119 times

Last updated: Mar 13 '16