/*
* Find path to JRE based on .exe's location or registry settings.
*/
jboolean
GetJREPath(char *path, jint pathsize)
{
char javadll[MAXPATHLEN];
struct stat s;
if (GetApplicationHome(path, pathsize)) { //If path is "c:\foo\bin\java", then application home is "c:\foo".
/* Is JRE co-located with the application? */
sprintf(javadll, "%s\\bin\\" JAVA_DLL, path);
if (stat(javadll, &s) == 0) {
goto found;
}
/* Does this app ship a private JRE in <apphome>\jre directory? */
sprintf(javadll, "%s\\jre\\bin\\" JAVA_DLL, path);
if (stat(javadll, &s) == 0) {
strcat(path, "\\jre");
goto found;
}
}
/* Look for a public JRE on this machine. Find path in registry. */
if (GetPublicJREHome(path, pathsize)) {
goto found;
}
fprintf(stderr, "Error: could not find " JAVA_DLL "\n");
return JNI_FALSE;
found:
if (_launcher_debug)
printf("JRE path is %s\n", path);
return JNI_TRUE;
}
2009年3月23日星期一
Java.exe使用哪个JRE
订阅:
博文评论 (Atom)
没有评论:
发表评论