3

I'm trying to create a launcher for a game I wrote in java using the java invocation api in c++. I'd like it to use the jre folder (from openjdk) that I bundled with the game so that people who don't have Java on their computers can still play the game.

However, this doesn't seem to work on my friend's computer (he doesn't have java installed) and has this message: "The code execution cannot proceed because jvm.dll was not found." Both of us are running windows 10.

I tried to set the system property java.home to that jre folder like below:

JavaVMInitArgs vm_args;
JavaVMOption* options = new JavaVMOption[4];

options[0].optionString = "-Djava.class.path=run.jar";
options[1].optionString = "-Djava.home=jre";
options[2].optionString = "-Xms1m"; // 1MB
options[3].optionString = "-Xmx1g"; // 1GB

vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 3;
vm_args.options = options;
vm_args.ignoreUnrecognized = false;

JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);

Does anyone have any insight into this? I have to use the java invocation library instead of just calling javaw.exe with some flags because I need to pass a global variable telling laptops with multiple GPUs to use the more powerful one.

Thank you!

hujasonx
  • 106
  • 3

0 Answers0