The relationship between a Java application and a C ++ application

I am trying to write a plugin for a Java application. The plugin should be able to tell the Java application that new events have been recognized (observer design pattern, poll ... this is not). The problem is that events are tracked by gestures from the Microsoft Kinect controller (I use C ++ and the Microsoft Kinect SDK because I need to). This means that I have to communicate between the Java application and my Kinect Application. I thought of something like an adapter design pattern, where a Java application β€œincludes” an interface (C ++ header file, dll, etc.). At first I thought about JNI, but then I need to write a DLL that will be used on both sides of the application, right? Another thing that I was thinking about was to provide gesture data via UDP (or something lighter?). The last thing I heard was to write a COM + assembly ... but, frankly, my knowledge of COM + is pretty small.

JAVA APPLICATION << ----- ??? ----- >> KINECT APPLICATION 
+4
source share
2 answers

I found several examples, such as here , here and here , in which it is recommended to use a shared memory structure or use sockets.

I think that in this case, transferring your programs through sockets would be a better idea, since your applications will not be closely connected, so you just need to set the IP address, port and a set of commands.

According to this , it is possible to create a C ++ server on Kinect, but apart from this I cannot say much, since I have never worked on projects related to Kinect.

+3
source

Maybe you should take a look at google Protocol Buffers .

Since you are considering JNI . I suggest you refer to this IBM tutorial .

JNI allows a java application to call c / C ++ methods and vice versa.

Also take a look at this question if you are calling java from C ++.

+4
source

Source: https://habr.com/ru/post/1400527/


All Articles