title: Java callback to C++ callback from C++
body: <p>There are countless of articles and questions about how to call Java code from C++ using JNI, and I can do that, I can call some Java function from C++.</p>
  
  <p>Now what I cannot find any information on is the following:</p>
  
  <p>Assume I have a Java function which requires a callback function passed to it. This callback function is called at some later point in time from a different thread.</p>
  
  <p>Now I want to call this function from a C++ program, and once the callback function is called, I want a C++ callback to be called. Can anybody point me to a source with information on how to do that?</p>
  
  <p>Background is I want to use a Java library inside an existing C++ project (all on Linux, though I doubt this is relevant). The overhead for calling Java functions through JNI is not an issue here. </p>