It seems most documentation or helper libraries relating to JNI (Java Native Interface) are concerned with calling native code from Java. This seems to be the main use of it, ev
I also had many difficulties getting JNI to work on different operating systems, coping with 32/64-bit architectures and making sure the correct shared libraries were found and loaded. I found CORBA (MICO and JacORB) difficult to use too.
I found no effective way to call from C/C++ into Java and my preferred solutions in this situation are to run my Java code as either:
a stand-alone program
that I can easily run from C/C++ programs
with java -cp myjar.jar org.foo.MyClass
. I guess this is too simplistic for your situation.
As a mini-server, accepting requests from C/C++ programs on a TCP/IP socket and returning results through this socket too. This requires writing networking and serializing functions but decouples the C/C++ and Java processes and you can clearly identify any problems as being in the C++ side or Java side.
As a Servlet in Tomcat and make HTTP requests from my C/C++ program (other servlet containers would also work too). This also requires writing networking and serializing functions. This is more like SOA.