91 |
91 |
92 /* |
92 /* |
93 * Prototypes for functions internal to launcher. |
93 * Prototypes for functions internal to launcher. |
94 */ |
94 */ |
95 static void SetClassPath(const char *s); |
95 static void SetClassPath(const char *s); |
|
96 static void SetModulesBootClassPath(const char *s); |
96 static void SelectVersion(int argc, char **argv, char **main_class); |
97 static void SelectVersion(int argc, char **argv, char **main_class); |
97 static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile, |
98 static jboolean ParseArguments(int *pargc, char ***pargv, char **pjarfile, |
98 char **pclassname, int *pret, const char *jvmpath); |
99 char **pclassname, int *pret, const char *jvmpath); |
99 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, |
100 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, |
100 InvocationFunctions *ifn); |
101 InvocationFunctions *ifn); |
274 * ParseArguments is false, the program should exit. |
275 * ParseArguments is false, the program should exit. |
275 */ |
276 */ |
276 if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret, jvmpath)) { |
277 if (!ParseArguments(&argc, &argv, &jarfile, &classname, &ret, jvmpath)) { |
277 return(ret); |
278 return(ret); |
278 } |
279 } |
|
280 |
|
281 /* Set bootclasspath for modules */ |
|
282 SetModulesBootClassPath(jrepath); |
279 |
283 |
280 /* Override class path if -jar flag was specified */ |
284 /* Override class path if -jar flag was specified */ |
281 if (jarfile != 0) { |
285 if (jarfile != 0) { |
282 SetClassPath(jarfile); |
286 SetClassPath(jarfile); |
283 } |
287 } |
682 { |
686 { |
683 char *def; |
687 char *def; |
684 const char *orig = s; |
688 const char *orig = s; |
685 static const char format[] = "-Djava.class.path=%s"; |
689 static const char format[] = "-Djava.class.path=%s"; |
686 s = JLI_WildcardExpandClasspath(s); |
690 s = JLI_WildcardExpandClasspath(s); |
|
691 def = JLI_MemAlloc(sizeof(format) |
|
692 - 2 /* strlen("%s") */ |
|
693 + JLI_StrLen(s)); |
|
694 sprintf(def, format, s); |
|
695 AddOption(def, NULL); |
|
696 if (s != orig) |
|
697 JLI_MemFree((char *) s); |
|
698 } |
|
699 |
|
700 /* |
|
701 * Set the bootclasspath for modules. |
|
702 * A temporary workaround until jigsaw is integrated into JDK 7. |
|
703 */ |
|
704 static void |
|
705 SetModulesBootClassPath(const char *jrepath) |
|
706 { |
|
707 char *def, *s; |
|
708 char pathname[MAXPATHLEN]; |
|
709 const char separator[] = { FILE_SEPARATOR, '\0' }; |
|
710 const char *orig = jrepath; |
|
711 static const char format[] = "-Xbootclasspath/p:%s"; |
|
712 struct stat statbuf; |
|
713 |
|
714 /* return if jre/lib/rt.jar exists */ |
|
715 sprintf(pathname, "%s%slib%srt.jar", jrepath, separator, separator); |
|
716 if (stat(pathname, &statbuf) == 0) { |
|
717 return; |
|
718 } |
|
719 |
|
720 /* return if jre/classes exists */ |
|
721 sprintf(pathname, "%s%sclasses", jrepath, separator); |
|
722 if (stat(pathname, &statbuf) == 0) { |
|
723 return; |
|
724 } |
|
725 |
|
726 /* modularized jre */ |
|
727 sprintf(pathname, "%s%slib%s*", jrepath, separator, separator); |
|
728 s = (char *) JLI_WildcardExpandClasspath(pathname); |
687 def = JLI_MemAlloc(sizeof(format) |
729 def = JLI_MemAlloc(sizeof(format) |
688 - 2 /* strlen("%s") */ |
730 - 2 /* strlen("%s") */ |
689 + JLI_StrLen(s)); |
731 + JLI_StrLen(s)); |
690 sprintf(def, format, s); |
732 sprintf(def, format, s); |
691 AddOption(def, NULL); |
733 AddOption(def, NULL); |