684 if (stat(jvmpath, &s) == 0) {
685 if (_launcher_debug)
686 printf("yes.\n");
687 return JNI_TRUE;
688 } else {
689 if (_launcher_debug)
690 printf("no.\n");
691 return JNI_FALSE;
692 }
693 }
694
695 /*
696 * Find path to JRE based on .exe's location or registry settings.
697 */
698 static jboolean
699 GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative)
700 {
701 char libjava[MAXPATHLEN];
702
703 if (GetApplicationHome(path, pathsize)) {
704 /* Is JRE co-located with the application? */
705 sprintf(libjava, "%s/lib/%s/" JAVA_DLL, path, arch);
706 if (access(libjava, F_OK) == 0) {
707 goto found;
708 }
709
710 /* Does the app ship a private JRE in <apphome>/jre directory? */
711 sprintf(libjava, "%s/jre/lib/%s/" JAVA_DLL, path, arch);
712 if (access(libjava, F_OK) == 0) {
713 strcat(path, "/jre");
714 goto found;
715 }
716 }
717
718 if (!speculative)
719 fprintf(stderr, "Error: could not find " JAVA_DLL "\n");
720 return JNI_FALSE;
721
722 found:
723 if (_launcher_debug)
|
684 if (stat(jvmpath, &s) == 0) {
685 if (_launcher_debug)
686 printf("yes.\n");
687 return JNI_TRUE;
688 } else {
689 if (_launcher_debug)
690 printf("no.\n");
691 return JNI_FALSE;
692 }
693 }
694
695 /*
696 * Find path to JRE based on .exe's location or registry settings.
697 */
698 static jboolean
699 GetJREPath(char *path, jint pathsize, char * arch, jboolean speculative)
700 {
701 char libjava[MAXPATHLEN];
702
703 if (GetApplicationHome(path, pathsize)) {
704
705 /* Is the JRE universal, i.e. no arch dir? */
706 sprintf(libjava, "%s/jre/lib/" JAVA_DLL, path);
707 if (access(libjava, F_OK) == 0) {
708 strcat(path, "/jre");
709 goto found;
710 }
711
712 /* Is JRE co-located with the application? */
713 sprintf(libjava, "%s/lib/%s/" JAVA_DLL, path, arch);
714 if (access(libjava, F_OK) == 0) {
715 goto found;
716 }
717
718 /* Does the app ship a private JRE in <apphome>/jre directory? */
719 sprintf(libjava, "%s/jre/lib/%s/" JAVA_DLL, path, arch);
720 if (access(libjava, F_OK) == 0) {
721 strcat(path, "/jre");
722 goto found;
723 }
724 }
725
726 if (!speculative)
727 fprintf(stderr, "Error: could not find " JAVA_DLL "\n");
728 return JNI_FALSE;
729
730 found:
731 if (_launcher_debug)
|