This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Calling a Java function from C++ using CNI
Of course, just because I don't believe it's true doesn't mean it
isn't. The following code works!
[HelloWorld.cc]
#include "HelloWorld.h"
#include <gcj/cni.h>
int
main()
{
JvCreateJavaVM( NULL);
HelloWorld::hello();
return 0;
}
[EOF]
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?
Thanks,
Shaun
> I am not that familiar with CNI, but surely you must
> initialise the Java runtime:
>
> http://gcc.gnu.org/onlinedocs/gcj/Invocation.html
>
> (See also the example at the bottom.)
>
> Hope this helps,
> Ranjit.