Advertisement

c++, jdk, creation of jvm problem. App just exist.

Started by January 09, 2010 05:34 AM
0 comments, last by VladimirAvetisian 13 years, 4 months ago
Hello guys. Im looking for help with implementaion of Java VM in my renderer written in C++ Im using jdk 1.6.0_17. This is the whole code of my test app which doesnt work:

#include <jni.h>
#include <conio.h>
#include <iostream>
#pragma comment(lib,"jvm.lib");
#include <stdio.h>


JNIEnv* create_vm() {
	JavaVM* jvm;
	JNIEnv* env;
	JavaVMInitArgs args;
	JavaVMOption options[1];
	
	/* There is a new JNI_VERSION_1_4, but it doesn't add anything for the purposes of our example. */
	args.version = JNI_VERSION_1_2;
	args.nOptions = 1;
	options[0].optionString = "-Djava.class.path=c:\\projects\\local\\inonit\\classes";
	args.options = options;
	args.ignoreUnrecognized = JNI_FALSE;

	JNI_CreateJavaVM(&jvm, (void **)&env, &args); //exit with code 1 (0x1)
	return env;
}
int main(int argc, char **argv) {
	JNIEnv* env = create_vm();
	//invoke_class( env );
	system("pause");
}

It quits at JNI_CreateJavaVM(&jvm, (void **)&env, &args); - The program '[3084] test.exe: Native' has exited with code 1 (0x1). anyone know why? Or can help me somehow with solving this problem? I tried chaning options[0].optionString to path to the classes stuff of jdk examples but it doesnt change anything... any help appreciated...
I have this problem too. Help anybody!

This topic is closed to new replies.

Advertisement