src/windows/bin/java_md.c::GetJVMPath
/*
* Given a JRE location and a JVM type, construct what the name the
* JVM shared library will be. Return true, if such a library
* exists, false otherwise.
*/
static jboolean
GetJVMPath(const char *jrepath, const char *jvmtype,
char *jvmpath, jint jvmpathsize)
{
struct stat s;
//如果jvmtype包含斜杠'/' | '\\',jvmpath = ${jvmtype}\\jvm.dll
//否则 jvmpath = %JRE_HOME%\\bin\\${jvmtype}\\jvm.dll
if (JLI_StrChr(jvmtype, '/') || JLI_StrChr(jvmtype, '\\')) {
JLI_Snprintf(jvmpath, jvmpathsize, "%s\\" JVM_DLL, jvmtype);
} else {
JLI_Snprintf(jvmpath, jvmpathsize, "%s\\bin\\%s\\" JVM_DLL,
jrepath, jvmtype);
}
//获取文件相关信息并储存到结构体stat s中,如果成功返回0,失败返回-1
if (stat(jvmpath, &s) == 0) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
}