I have a java application I need to pass some info to a C++ program. It has been suggested that I use some simple socket programming to do this. Is this the best way? If not
Although an answer has been accepted, a key problem here is the semantic mismatch between the two languages: assuming you have some sort of stream connection going on, how do you efficiently interchange data?
One solution I might recommend is Google Protocol Buffers. It doesn't solve the subprocess/JNI/socket issue, but what it does do is allow you a pretty efficient way to have a complex object structure transit over a stream protocol.
Remember: JNI is complicated, particularly for complex object references, but it's efficient. The most important thing is to pass data over that efficient context switch properly. GPB+JNI/Sub-Process Socket allows a single context switch to pull data over, combined with efficient codec support on both sides.