我试图用load jvm.dll LoadLibrary()创建JavaVM

时间:2019-05-06 08:19:00

标签: java c++

我试图加载jvm.dll并创建JavaVM。

我尝试了LoadLibrary()

JNIEnv *env;
JavaVM *jvm;
HINSTANCE hinstLib = LoadLibrary(TEXT("C:\\SkidFlare\\jre\\bin\\server\\jvm.dll"));
    typedef jint(JNICALL *PtrCreateJavaVM)(JavaVM **, void **, void *);
    PtrCreateJavaVM ptrCreateJavaVM = (PtrCreateJavaVM)GetProcAddress(hinstLib, "JNI_CreateJavaVM");
JavaVMOption options[3];
JavaVMInitArgs vm_args;
vm_args.version = JNI_VERSION_1_8;
int argsinited = JNI_GetDefaultJavaVMInitArgs(&vm_args);
if (argsinited != JNI_OK) {
    cout << "Failled to init JVM Args" << endl;
    return -1;
}
else {
    cout << "Success to init JVM Args" << endl;
}
SetConsoleTitle(L"SkidFlare application launcher - stage [1]");
vm_args.options = options;
vm_args.nOptions = 1;
options[0].optionString = (char*) "-XX:+DisableAttachMechanism";
res = ptrCreateJavaVM(&jvm, (void**)&env, &vm_args);

找不到jvm.dll。

0 个答案:

没有答案