jdk/src/java.base/share/native/launcher/main.c
changeset 43325 033e4cced1dc
parent 41966 bac52fa6e617
child 43691 f3c0d65c7b17
--- a/jdk/src/java.base/share/native/launcher/main.c	Thu Jan 26 21:21:16 2017 +0000
+++ b/jdk/src/java.base/share/native/launcher/main.c	Wed Jan 25 12:52:40 2017 -0800
@@ -127,7 +127,22 @@
         // accommodate the NULL at the end
         JLI_List args = JLI_List_new(argc + 1);
         int i = 0;
-        for (i = 0; i < argc; i++) {
+
+        // Add first arg, which is the app name
+        JLI_List_add(args, JLI_StringDup(argv[0]));
+        // Append JAVA_OPTIONS
+        if (JLI_AddArgsFromEnvVar(args, JAVA_OPTIONS)) {
+            // JLI_SetTraceLauncher is not called yet
+            // Show _JAVA_OPTIONS content along with JAVA_OPTIONS to aid diagnosis
+            if (getenv(JLDEBUG_ENV_ENTRY)) {
+                char *tmp = getenv("_JAVA_OPTIONS");
+                if (NULL != tmp) {
+                    JLI_ReportMessage(ARG_INFO_ENVVAR, "_JAVA_OPTIONS", tmp);
+                }
+            }
+        }
+        // Iterate the rest of command line
+        for (i = 1; i < argc; i++) {
             JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
             if (NULL == argsInFile) {
                 JLI_List_add(args, JLI_StringDup(argv[i]));