The official way to invoke your own platform (implicitly, all C / C ++ code) from Java is JNI . I would not call it "not very painful."
You can look at SWIG to generate most of the nasty code for you, I used it a couple of times some of my own C code with some success. I was forced to "process-out" some of my code to make it Java-readable, however.
An option that I read about, but was never used personally, by JNA . It looks smaller than JNI, but I can't vouch for it.
All of these solutions are Java oriented, but I don’t understand why you couldn’t use them in any JVM hosted language.
source
share