src/java.base/share/native/launcher/main.c

Print this page

        

@@ -104,21 +104,16 @@
             for (i = 0 ; i < __argc ; i++) {
                 printf("wwwd_args[%d] = %s\n", i, __argv[i]);
             }
         }
     }
-    JLI_CmdToArgs(GetCommandLine());
-    margc = JLI_GetStdArgc();
-    // add one more to mark the end
-    margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));
-    {
-        int i = 0;
-        StdArg *stdargs = JLI_GetStdArgs();
-        for (i = 0 ; i < margc ; i++) {
-            margv[i] = stdargs[i].arg;
-        }
-        margv[i] = NULL;
+
+    // On Windows command line arguments could be encoded as Unicode
+    // if it is declared explicitly.
+    // Try to parse them as Unicode and if failed, then parse as ASCII.
+    if (!JLI_DecodeArgs(&margc, &margv)) {
+        exit(1);
     }
 #else /* *NIXES */
     margc = argc;
     margv = argv;
 #endif /* WIN32 */