src/share/bin/java.c::InitializeJVM
/*
* Initializes the Java Virtual Machine. Also frees options array when
* finished.
*/
static jboolean
InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
{
JavaVMInitArgs args;
jint r;
memset(&args, 0, sizeof(args));
args.version = JNI_VERSION_1_2;
//@see: 10.AddApplicationOptions
//@see: 12.ParseArguments
args.nOptions = numOptions;
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;
if (JLI_IsTraceLauncher()) {
int i = 0;
//JavaVM args:
// version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 5
// option[ 0] = '-Dsun.java.launcher.diag=true'
// option[ 1] = '-Djava.class.path=.;C:\Tools\Java\jdk1.8.0_191\lib;C:\Tools\Java\jdk1.8.0_191\lib\tools.jar'
// option[ 2] = '-Djava.class.path=test.jar'
// option[ 3] = '-Dsun.java.command=test.jar'
// option[ 4] = '-Dsun.java.launcher=SUN_STANDARD'
printf("JavaVM args:\n ");
printf("version 0x%08lx, ", (long)args.version);
printf("ignoreUnrecognized is %s, ",
args.ignoreUnrecognized ? "JNI_TRUE" : "JNI_FALSE");
printf("nOptions is %ld\n", (long)args.nOptions);
for (i = 0; i < numOptions; i++)
printf(" option[%2d] = '%s'\n",
i, args.options[i].optionString);
}
//@see: 8.LoadJavaVM
r = ifn->CreateJavaVM(pvm, (void **)penv, &args);
JLI_MemFree(options);
return r == JNI_OK;
}