--- old/src/java.base/share/native/launcher/main.c 2015-07-15 12:24:24.000000000 -0700 +++ new/src/java.base/share/native/launcher/main.c 2015-07-15 12:24:24.000000000 -0700 @@ -31,6 +31,7 @@ */ #include "defines.h" +#include "jli_util.h" #ifdef _MSC_VER #if _MSC_VER > 1400 && _MSC_VER < 1600 @@ -106,7 +107,7 @@ } } } - JLI_CmdToArgs(GetCommandLine()); + JLI_CmdToArgs(GetCommandLine(), HAS_JAVA_ARGS); margc = JLI_GetStdArgc(); // add one more to mark the end margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *))); @@ -119,8 +120,30 @@ margv[i] = NULL; } #else /* *NIXES */ - margc = argc; - margv = argv; + // accommodate the NULL at the end + JLI_List args = JLI_List_new(argc + 1); + { + int i = 0; + for (i = 0; i < argc; i++) { + JLI_List argsInFile = JLI_ExpandArgFile(argv[i], HAS_JAVA_ARGS); + if (NULL == argsInFile) { + JLI_List_add(args, JLI_StringDup(argv[i])); + } else { + int cnt, idx; + cnt = argsInFile->size; + for (idx = 0; idx < cnt; idx++) { + JLI_List_add(args, argsInFile->elements[idx]); + } + // Shallow free, we reuse the string to avoid copy + JLI_MemFree(argsInFile->elements); + JLI_MemFree(argsInFile); + } + } + } + margc = args->size; + // add the NULL pointer at argv[argc] + JLI_List_add(args, NULL); + margv = args->elements; #endif /* WIN32 */ return JLI_Launch(margc, margv, sizeof(const_jargs) / sizeof(char *), const_jargs,