c++ - Load JVM in a DLL -
i loading jvm in dll fails (indicated in code fails.). tried same code in exe , works fine.
javavminitargs vm_args; /* jdk 1.1 vm initialization arguments */ jnienv *env; javavmoption options; options.optionstring = "-djava.class.path=c:\\core\\bin\\otk-1.4.1-with-dependencies.jar"; vm_args.version = jni_version_1_6; vm_args.noptions = 1; vm_args.options = &options; vm_args.ignoreunrecognized = 0; jvm_dll = loadlibrary("c:\\program files\\java\\jdk1.6.0_23\\jre\\bin\\server\\jvm.dll"); if(jvm_dll == null) { getmanager()->log( "initialisejava::can't load jvm dll.", high_importance ); return false; } jni_createjavavm_ptr = (jni_createjavavm_func)getprocaddress(jvm_dll, "jni_createjavavm"); if(jni_createjavavm_ptr == null) { getmanager()->log( "initialisejava::can't create jvm.", high_importance ); return false; } int ret = jni_createjavavm_ptr(jvm, (void**)&env, &vm_args); // fails here if(ret < 0) { getmanager()->log( "initialisejava::unable call jvm.", high_importance ); return false; }
please help.
Comments
Post a Comment