Calling Java code from c++ in an Android application
<p>I'm currently attempting to call some Java code from C++ in an Android application using JNI. However, I cannot get anything to compile when I attempt to create a java virtual machine using the "JNI_CreateJavaVM" method. It comes up with the error: "undefined reference to `JNI_CreateJavaVM'"</p>

<p>It's clearly declared in the jni.h header file, and I am able to make use of type and struct definitions that are made in the header file without error, so the code is definitely including it. It's just unable to compile when I attempt to make use of JNI_CreateJavaVM. Is there something else that needs to be included along with it, or is there some other method of getting a virtual machine to make calls to Java from C++?</p>

<p>Here is the code I'm attempting to build it with:</p>

<pre><code>#include "HelloWorldScene.h"
#include &lt;stdio.h&gt;
#include &lt;jni.h&gt;
#include &lt;string.h&gt;


bool HelloWorld::init()
{
    JavaVM* jvm;
    JNIEnv* env;
    JavaVMInitArgs args;
    jint result = JNI_CreateJavaVM(&amp;jvm, &amp;env, (void*)&amp;args);//The code compiles if this line is commented out.

    //...Various initialization procedures

    return true;
}
</code></pre>
