I'm working on a application which has Java web interface hosted on Glassfish server and C kernel which is implemented as Linux daemon.
My biggest problem right now is how to make Remote Procedure Calls. I need to call functions and methods in both directions. These are the possible solutions that I can think of:
I want to use the most basic way without using external libraries or frameworks. Is it possible directly to call functions/methods between Java and C using only sockets? The OS that I use is Centos.
Is there more elegant way to connect the two languages?
Without external libraries, only sockets remain. But I would classify DBus as an external library, wouldn't you?
If the C program can use sockets, there is no need for Java Native Interface. The Java code can open sockets from Java, calling the sockets the C code listens to.
If you allow DBus, maybe you should consider the plethora of networking and RPC protocols which have libraries for both C and Java. (Again, no need to use JNI.)
Going the DBus way, look at the Java documentation and the tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With