jdk/make/launcher/LauncherCommon.gmk
changeset 36511 9d0388c6b336
parent 35781 88c56fe09cb8
child 42753 40f61533b93d
--- a/jdk/make/launcher/LauncherCommon.gmk	Tue Mar 15 13:48:26 2016 -0700
+++ b/jdk/make/launcher/LauncherCommon.gmk	Thu Mar 17 19:04:16 2016 +0000
@@ -63,6 +63,8 @@
 # used as the name of the executable.
 #
 # Remaining parameters are named arguments. These include:
+# MAIN_MODULE  The module of the main class to launch if different from the
+#     current module
 # MAIN_CLASS   The Java main class to launch
 # JAVA_ARGS   Processed into a -DJAVA_ARGS C flag
 # CFLAGS   Additional CFLAGS
@@ -97,9 +99,13 @@
     $1_JAVA_ARGS += -ms8m
   endif
 
+  ifeq ($$($1_MAIN_MODULE), )
+    $1_MAIN_MODULE := $(MODULE)
+  endif
+
   ifneq ($$($1_JAVA_ARGS), )
     $1_JAVA_ARGS_STR := '{ $$(strip $$(foreach a, \
-        $$(addprefix -J, $$($1_JAVA_ARGS)) $$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
+        $$(addprefix -J, $$($1_JAVA_ARGS)) -m $$($1_MAIN_MODULE)/$$($1_MAIN_CLASS), "$$a"$(COMMA) )) }'
     $1_CFLAGS += -DJAVA_ARGS=$$($1_JAVA_ARGS_STR)
   endif