Calling a Java function from C++ using CNI

Shaun Jackman sjackman@telus.net
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!
[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.



More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /