Calling a Java function from C++ using CNI

Shaun Jackman
Tue Aug 10 16:39:00 GMT 2004

Of course, just because I don't believe it's true doesn't mean it
isn't. The following code works!

#include "HelloWorld.h"
#include <gcj/cni.h>

	JvCreateJavaVM( NULL);
	return 0;

What does JvCreateJavaVM accomplish? Could it be called lazily, simply
called the first time a Java object is created or a Java static
function is called?


> I am not that familiar with CNI, but surely you must
> initialise the Java runtime:
> (See also the example at the bottom.)
> Hope this helps,
> Ranjit.

More information about the Java mailing list