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

Print this page




  89     __initenv = _environ;
  90 
  91 #else /* JAVAW */
  92 int
  93 main(int argc, char **argv)
  94 {
  95     int margc;
  96     char** margv;
  97     const jboolean const_javaw = JNI_FALSE;
  98 #endif /* JAVAW */
  99 #ifdef _WIN32
 100     {
 101         int i = 0;
 102         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
 103             printf("Windows original main args:\n");
 104             for (i = 0 ; i < __argc ; i++) {
 105                 printf("wwwd_args[%d] = %s\n", i, __argv[i]);
 106             }
 107         }
 108     }
 109     JLI_CmdToArgs(GetCommandLine());
 110     margc = JLI_GetStdArgc();
 111     // add one more to mark the end
 112     margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));
 113     {
 114         int i = 0;
 115         StdArg *stdargs = JLI_GetStdArgs();
 116         for (i = 0 ; i < margc ; i++) {
 117             margv[i] = stdargs[i].arg;
 118         }
 119         margv[i] = NULL;
 120     }
 121 #else /* *NIXES */
 122     margc = argc;
 123     margv = argv;
 124 #endif /* WIN32 */
 125     return JLI_Launch(margc, margv,
 126                    sizeof(const_jargs) / sizeof(char *), const_jargs,
 127                    sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
 128                    FULL_VERSION,
 129                    DOT_VERSION,
 130                    (const_progname != NULL) ? const_progname : *margv,
 131                    (const_launcher != NULL) ? const_launcher : *margv,
 132                    HAS_JAVA_ARGS,
 133                    const_cpwildcard, const_javaw, const_ergo_class);
 134 }


  89     __initenv = _environ;
  90 
  91 #else /* JAVAW */
  92 int
  93 main(int argc, char **argv)
  94 {
  95     int margc;
  96     char** margv;
  97     const jboolean const_javaw = JNI_FALSE;
  98 #endif /* JAVAW */
  99 #ifdef _WIN32
 100     {
 101         int i = 0;
 102         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
 103             printf("Windows original main args:\n");
 104             for (i = 0 ; i < __argc ; i++) {
 105                 printf("wwwd_args[%d] = %s\n", i, __argv[i]);
 106             }
 107         }
 108     }
 109 
 110     // On Windows command line arguments could be encoded as Unicode
 111     // if it is declared explicitly.
 112     // Try to parse them as Unicode and if failed, then parse as ASCII.
 113     if (!JLI_DecodeArgs(&margc, &margv)) {
 114         exit(1);





 115     }
 116 #else /* *NIXES */
 117     margc = argc;
 118     margv = argv;
 119 #endif /* WIN32 */
 120     return JLI_Launch(margc, margv,
 121                    sizeof(const_jargs) / sizeof(char *), const_jargs,
 122                    sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
 123                    FULL_VERSION,
 124                    DOT_VERSION,
 125                    (const_progname != NULL) ? const_progname : *margv,
 126                    (const_launcher != NULL) ? const_launcher : *margv,
 127                    HAS_JAVA_ARGS,
 128                    const_cpwildcard, const_javaw, const_ergo_class);
 129 }