title: Embed Java into a C++ application?
body: <p>I got an application written in C++ and I am able to extend the applications functionality by writing plugins in C++ for it.</p>
  
  <p>What I basically want to do is to embed Java into this application. This has already been done with Python (not done by me).</p>
  
  <p>I read something about JNI but there is always the speech from a full programm that uses Java classes.</p>
  
  <p>What I'd like to do is, to use classes from C++ in Java to interact with the application.<br>
  It's a 3D app in this case, called Cinema 4D.</p>
  
  <p>Is there a way to compile and evaluate Java code while the application is running (in some sort of scripting language) using JNI or anything like it ? </p>
  
  <p>Example imaginary code after the embedding was done:</p>
  
  <pre><code>import c4d.documents.*;
  
  class Main {
    public static void main() {
      BaseDocument doc = GetActiveDocument();
      BaseObject op = doc.GetActiveObject();
      if (op != null) {
        op.Remove();
      }
    }
  }
  </code></pre>
  
  <p>This code should interact with Cinema 4D to delete the selected object.</p>