< prev index next >

src/java.base/share/native/libjli/java.c

Print this page


   1 /*
   2  * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  81 static jboolean _wc_enabled = JNI_FALSE;
  82 
  83 /*
  84  * Entries for splash screen environment variables.
  85  * putenv is performed in SelectVersion. We need
  86  * them in memory until UnsetEnv, so they are made static
  87  * global instead of auto local.
  88  */
  89 static char* splash_file_entry = NULL;
  90 static char* splash_jar_entry = NULL;
  91 
  92 /*
  93  * List of VM options to be specified when the VM is created.
  94  */
  95 static JavaVMOption *options;
  96 static int numOptions, maxOptions;
  97 
  98 /*
  99  * Prototypes for functions internal to launcher.
 100  */

 101 static void SetClassPath(const char *s);
 102 static void SetMainModule(const char *s);
 103 static void SelectVersion(int argc, char **argv, char **main_class);
 104 static void SetJvmEnvironment(int argc, char **argv);
 105 static jboolean ParseArguments(int *pargc, char ***pargv,
 106                                int *pmode, char **pwhat,
 107                                int *pret, const char *jrepath);
 108 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
 109                               InvocationFunctions *ifn);
 110 static jstring NewPlatformString(JNIEnv *env, char *s);
 111 static jclass LoadMainClass(JNIEnv *env, int mode, char *name);
 112 static jclass GetApplicationClass(JNIEnv *env);
 113 
 114 static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv);
 115 static jboolean AddApplicationOptions(int cpathc, const char **cpathv);
 116 static void SetApplicationClassPath(const char**);
 117 
 118 static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
 119 static void PrintUsage(JNIEnv* env, jboolean doXUsage);
 120 static void ShowSettings(JNIEnv* env, char *optString);
 121 static void ListModules(JNIEnv* env, char *optString);
 122 
 123 static void SetPaths(int argc, char **argv);
 124 
 125 static void DumpState();
 126 static jboolean RemovableOption(char *option);
 127 
 128 enum OptionKind {
 129     LAUNCHER_OPTION = 0,
 130     LAUNCHER_OPTION_WITH_ARGUMENT,
 131     LAUNCHER_MAIN_OPTION,
 132     VM_LONG_OPTION,
 133     VM_LONG_OPTION_WITH_ARGUMENT,
 134     VM_OPTION
 135 };
 136 
 137 static int GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue);
 138 static jboolean IsOptionWithArgument(int argc, char **argv);
 139 
 140 /* Maximum supported entries from jvm.cfg. */
 141 #define INIT_MAX_KNOWN_VMS      10
 142 
 143 /* Values for vmdesc.flag */
 144 enum vmdesc_flag {
 145     VM_UNKNOWN = -1,
 146     VM_KNOWN,


 243         int i;
 244         printf("Command line args:\n");
 245         for (i = 0; i < argc ; i++) {
 246             printf("argv[%d] = %s\n", i, argv[i]);
 247         }
 248         AddOption("-Dsun.java.launcher.diag=true", NULL);
 249     }
 250 
 251     /*
 252      * SelectVersion() has several responsibilities:
 253      *
 254      *  1) Disallow specification of another JRE.  With 1.9, another
 255      *     version of the JRE cannot be invoked.
 256      *  2) Allow for a JRE version to invoke JDK 1.9 or later.  Since
 257      *     all mJRE directives have been stripped from the request but
 258      *     the pre 1.9 JRE [ 1.6 thru 1.8 ], it is as if 1.9+ has been
 259      *     invoked from the command line.
 260      */
 261     SelectVersion(argc, argv, &main_class);
 262 


 263     CreateExecutionEnvironment(&argc, &argv,
 264                                jrepath, sizeof(jrepath),
 265                                jvmpath, sizeof(jvmpath),
 266                                jvmcfg,  sizeof(jvmcfg));
 267 
 268     if (!IsJavaArgs()) {
 269         SetJvmEnvironment(argc,argv);
 270     }
 271 
 272     ifn.CreateJavaVM = 0;
 273     ifn.GetDefaultJavaVMInitArgs = 0;
 274 
 275     if (JLI_IsTraceLauncher()) {
 276         start = CounterGet();
 277     }
 278 
 279     if (!LoadJavaVM(jvmpath, &ifn)) {
 280         return(6);
 281     }
 282 


 725         }
 726         /* fall through */
 727     case VM_IGNORE:
 728         jvmtype = knownVMs[jvmidx=0].name + 1;
 729         /* fall through */
 730     case VM_KNOWN:
 731         break;
 732     case VM_ERROR:
 733         if (!speculative) {
 734             JLI_ReportErrorMessage(CFG_ERROR3, jvmtype);
 735             exit(1);
 736         } else {
 737             return "ERROR";
 738         }
 739     }
 740 
 741     return jvmtype;
 742 }
 743 
 744 /*
 745  * static void SetJvmEnvironment(int argc, char **argv);
 746  *   Is called just before the JVM is loaded.  We can set env variables
 747  *   that are consumed by the JVM.  This function is non-destructive,
 748  *   leaving the arg list intact.  The first use is for the JVM flag
 749  *   -XX:NativeMemoryTracking=value.
 750  */
 751 static void





















 752 SetJvmEnvironment(int argc, char **argv) {
 753 
 754     static const char*  NMT_Env_Name    = "NMT_LEVEL_";
 755     int i;

 756     for (i = 0; i < argc; i++) {
 757         char *arg = argv[i];
 758         /*
 759          * Since this must be a VM flag we stop processing once we see
 760          * an argument the launcher would not have processed beyond (such
 761          * as -version or -h), or an argument that indicates the following
 762          * arguments are for the application (i.e. the main class name, or
 763          * the -jar argument).
 764          */
 765         if (i > 0) {
 766             char *prev = argv[i - 1];
 767             // skip non-dash arg preceded by class path specifiers
 768             if (*arg != '-' && IsWhiteSpaceOption(prev)) {
 769                 continue;
 770             }
 771 
 772             if (*arg != '-' || isTerminalOpt(arg)) {
 773                 return;
 774             }
 775         }


 794                  *   that could store the address.
 795                  */
 796                 char * pbuf = (char*)JLI_MemAlloc(pbuflen);
 797 
 798                 JLI_Snprintf(pbuf, pbuflen, "%s%d=%s", NMT_Env_Name, JLI_GetPid(), value);
 799                 retval = JLI_PutEnv(pbuf);
 800                 if (JLI_IsTraceLauncher()) {
 801                     char* envName;
 802                     char* envBuf;
 803 
 804                     // ensures that malloc successful
 805                     envName = (char*)JLI_MemAlloc(pbuflen);
 806                     JLI_Snprintf(envName, pbuflen, "%s%d", NMT_Env_Name, JLI_GetPid());
 807 
 808                     printf("TRACER_MARKER: NativeMemoryTracking: env var is %s\n",envName);
 809                     printf("TRACER_MARKER: NativeMemoryTracking: putenv arg %s\n",pbuf);
 810                     envBuf = getenv(envName);
 811                     printf("TRACER_MARKER: NativeMemoryTracking: got value %s\n",envBuf);
 812                     free(envName);
 813                 }
 814 
 815             }
 816 
 817         }
 818 
 819     }
 820 }
 821 
 822 /* copied from HotSpot function "atomll()" */
 823 static int
 824 parse_size(const char *s, jlong *result) {
 825   jlong n = 0;
 826   int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
 827   if (args_read != 1) {
 828     return 0;
 829   }
 830   while (*s != '\0' && *s >= '0' && *s <= '9') {
 831     s++;
 832   }
 833   // 4705540: illegal if more characters are found after the first non-digit
 834   if (JLI_StrLen(s) > 1) {
 835     return 0;
 836   }
 837   switch (*s) {
 838     case 'T': case 't':


1366         } else if (JLI_StrCmp(arg, "-verifyremote") == 0) {
1367             AddOption("-Xverify:remote", NULL);
1368         } else if (JLI_StrCmp(arg, "-noverify") == 0) {
1369             AddOption("-Xverify:none", NULL);
1370         } else if (JLI_StrCCmp(arg, "-ss") == 0 ||
1371                    JLI_StrCCmp(arg, "-oss") == 0 ||
1372                    JLI_StrCCmp(arg, "-ms") == 0 ||
1373                    JLI_StrCCmp(arg, "-mx") == 0) {
1374             char *tmp = JLI_MemAlloc(JLI_StrLen(arg) + 6);
1375             sprintf(tmp, "-X%s", arg + 1); /* skip '-' */
1376             AddOption(tmp, NULL);
1377         } else if (JLI_StrCmp(arg, "-checksource") == 0 ||
1378                    JLI_StrCmp(arg, "-cs") == 0 ||
1379                    JLI_StrCmp(arg, "-noasyncgc") == 0) {
1380             /* No longer supported */
1381             JLI_ReportErrorMessage(ARG_WARN, arg);
1382         } else if (JLI_StrCCmp(arg, "-splash:") == 0) {
1383             ; /* Ignore machine independent options already handled */
1384         } else if (ProcessPlatformOption(arg)) {
1385             ; /* Processing of platform dependent options */
1386         } else if (RemovableOption(arg)) {
1387             ; /* Do not pass option to vm. */
1388         } else {
1389             /* java.class.path set on the command line */
1390             if (JLI_StrCCmp(arg, "-Djava.class.path=") == 0) {
1391                 _have_classpath = JNI_TRUE;
1392             }
1393             AddOption(arg, NULL);
1394         }
1395     }
1396 
1397     if (*pwhat == NULL && --argc >= 0) {
1398         *pwhat = *argv++;
1399     }
1400 
1401     if (*pwhat == NULL) {
1402         *pret = 1;
1403     } else if (mode == LM_UNKNOWN) {
1404         /* default to LM_CLASS if -m, -jar and -cp options are
1405          * not specified */
1406         if (!_have_classpath) {
1407             SetClassPath(".");


2245        * the callee
2246        */
2247       return (ret != 0) ? ret : rslt;
2248     }
2249 }
2250 
2251 static void
2252 DumpState()
2253 {
2254     if (!JLI_IsTraceLauncher()) return ;
2255     printf("Launcher state:\n");
2256     printf("\tFirst application arg index: %d\n", JLI_GetAppArgIndex());
2257     printf("\tdebug:%s\n", (JLI_IsTraceLauncher() == JNI_TRUE) ? "on" : "off");
2258     printf("\tjavargs:%s\n", (_is_java_args == JNI_TRUE) ? "on" : "off");
2259     printf("\tprogram name:%s\n", GetProgramName());
2260     printf("\tlauncher name:%s\n", GetLauncherName());
2261     printf("\tjavaw:%s\n", (IsJavaw() == JNI_TRUE) ? "on" : "off");
2262     printf("\tfullversion:%s\n", GetFullVersion());
2263 }
2264 
2265 /*
2266  * Return JNI_TRUE for an option string that has no effect but should
2267  * _not_ be passed on to the vm; return JNI_FALSE otherwise.  On
2268  * Solaris SPARC, this screening needs to be done if:
2269  *    -d32 or -d64 is passed to a binary with an unmatched data model
2270  *    (the exec in CreateExecutionEnvironment removes -d<n> options and points the
2271  *    exec to the proper binary).  In the case of when the data model and the
2272  *    requested version is matched, an exec would not occur, and these options
2273  *    were erroneously passed to the vm.
2274  */
2275 jboolean
2276 RemovableOption(char * option)
2277 {
2278   /*
2279    * Unconditionally remove both -d32 and -d64 options since only
2280    * the last such options has an effect; e.g.
2281    * java -d32 -d64 -d32 -version
2282    * is equivalent to
2283    * java -d32 -version
2284    */
2285 
2286   if( (JLI_StrCCmp(option, "-d32")  == 0 ) ||
2287       (JLI_StrCCmp(option, "-d64")  == 0 ) )
2288     return JNI_TRUE;
2289   else
2290     return JNI_FALSE;
2291 }
2292 
2293 /*
2294  * A utility procedure to always print to stderr
2295  */
2296 void
2297 JLI_ReportMessage(const char* fmt, ...)
2298 {
2299     va_list vl;
2300     va_start(vl, fmt);
2301     vfprintf(stderr, fmt, vl);
2302     fprintf(stderr, "\n");
2303     va_end(vl);
2304 }
2305 
2306 /*
2307  * A utility procedure to always print to stdout
2308  */
2309 void
2310 JLI_ShowMessage(const char* fmt, ...)
2311 {
2312     va_list vl;
   1 /*
   2  * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  81 static jboolean _wc_enabled = JNI_FALSE;
  82 
  83 /*
  84  * Entries for splash screen environment variables.
  85  * putenv is performed in SelectVersion. We need
  86  * them in memory until UnsetEnv, so they are made static
  87  * global instead of auto local.
  88  */
  89 static char* splash_file_entry = NULL;
  90 static char* splash_jar_entry = NULL;
  91 
  92 /*
  93  * List of VM options to be specified when the VM is created.
  94  */
  95 static JavaVMOption *options;
  96 static int numOptions, maxOptions;
  97 
  98 /*
  99  * Prototypes for functions internal to launcher.
 100  */
 101 static void CheckJvmArguments(int argc, char **argv);
 102 static void SetClassPath(const char *s);
 103 static void SetMainModule(const char *s);
 104 static void SelectVersion(int argc, char **argv, char **main_class);
 105 static void SetJvmEnvironment(int argc, char **argv);
 106 static jboolean ParseArguments(int *pargc, char ***pargv,
 107                                int *pmode, char **pwhat,
 108                                int *pret, const char *jrepath);
 109 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv,
 110                               InvocationFunctions *ifn);
 111 static jstring NewPlatformString(JNIEnv *env, char *s);
 112 static jclass LoadMainClass(JNIEnv *env, int mode, char *name);
 113 static jclass GetApplicationClass(JNIEnv *env);
 114 
 115 static void TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***pargv);
 116 static jboolean AddApplicationOptions(int cpathc, const char **cpathv);
 117 static void SetApplicationClassPath(const char**);
 118 
 119 static void PrintJavaVersion(JNIEnv *env, jboolean extraLF);
 120 static void PrintUsage(JNIEnv* env, jboolean doXUsage);
 121 static void ShowSettings(JNIEnv* env, char *optString);
 122 static void ListModules(JNIEnv* env, char *optString);
 123 
 124 static void SetPaths(int argc, char **argv);
 125 
 126 static void DumpState();

 127 
 128 enum OptionKind {
 129     LAUNCHER_OPTION = 0,
 130     LAUNCHER_OPTION_WITH_ARGUMENT,
 131     LAUNCHER_MAIN_OPTION,
 132     VM_LONG_OPTION,
 133     VM_LONG_OPTION_WITH_ARGUMENT,
 134     VM_OPTION
 135 };
 136 
 137 static int GetOpt(int *pargc, char ***pargv, char **poption, char **pvalue);
 138 static jboolean IsOptionWithArgument(int argc, char **argv);
 139 
 140 /* Maximum supported entries from jvm.cfg. */
 141 #define INIT_MAX_KNOWN_VMS      10
 142 
 143 /* Values for vmdesc.flag */
 144 enum vmdesc_flag {
 145     VM_UNKNOWN = -1,
 146     VM_KNOWN,


 243         int i;
 244         printf("Command line args:\n");
 245         for (i = 0; i < argc ; i++) {
 246             printf("argv[%d] = %s\n", i, argv[i]);
 247         }
 248         AddOption("-Dsun.java.launcher.diag=true", NULL);
 249     }
 250 
 251     /*
 252      * SelectVersion() has several responsibilities:
 253      *
 254      *  1) Disallow specification of another JRE.  With 1.9, another
 255      *     version of the JRE cannot be invoked.
 256      *  2) Allow for a JRE version to invoke JDK 1.9 or later.  Since
 257      *     all mJRE directives have been stripped from the request but
 258      *     the pre 1.9 JRE [ 1.6 thru 1.8 ], it is as if 1.9+ has been
 259      *     invoked from the command line.
 260      */
 261     SelectVersion(argc, argv, &main_class);
 262 
 263     CheckJvmArguments(argc, argv);
 264 
 265     CreateExecutionEnvironment(&argc, &argv,
 266                                jrepath, sizeof(jrepath),
 267                                jvmpath, sizeof(jvmpath),
 268                                jvmcfg,  sizeof(jvmcfg));
 269 
 270     if (!IsJavaArgs()) {
 271         SetJvmEnvironment(argc,argv);
 272     }
 273 
 274     ifn.CreateJavaVM = 0;
 275     ifn.GetDefaultJavaVMInitArgs = 0;
 276 
 277     if (JLI_IsTraceLauncher()) {
 278         start = CounterGet();
 279     }
 280 
 281     if (!LoadJavaVM(jvmpath, &ifn)) {
 282         return(6);
 283     }
 284 


 727         }
 728         /* fall through */
 729     case VM_IGNORE:
 730         jvmtype = knownVMs[jvmidx=0].name + 1;
 731         /* fall through */
 732     case VM_KNOWN:
 733         break;
 734     case VM_ERROR:
 735         if (!speculative) {
 736             JLI_ReportErrorMessage(CFG_ERROR3, jvmtype);
 737             exit(1);
 738         } else {
 739             return "ERROR";
 740         }
 741     }
 742 
 743     return jvmtype;
 744 }
 745 
 746 /*
 747  * Check VM arguments.




 748  */
 749 static void
 750 CheckJvmArguments(int argc, char **argv) {
 751     /* scan for data model options, raise a fatal error if found */
 752     int i = 0;
 753     for (i = 1; i < argc; i++) {
 754         if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
 755             JLI_ReportErrorMessage(ARG_ERROR0, "-d64/-J-d64");
 756             exit(2);
 757         }
 758         if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
 759             JLI_ReportErrorMessage(ARG_ERROR0, "-d32/-J-d32");
 760             exit(2);
 761         }
 762     }
 763 }
 764 
 765 /*
 766  * This method must be called before the VM is loaded, primarily
 767  * used to parse and set any VM related options or env variables.
 768  * This function is non-destructive leaving the argument list intact.
 769  */
 770 static void
 771 SetJvmEnvironment(int argc, char **argv) {
 772 
 773     static const char*  NMT_Env_Name    = "NMT_LEVEL_";
 774     int i;
 775     /* process only the launcher arguments */
 776     for (i = 0; i < argc; i++) {
 777         char *arg = argv[i];
 778         /*
 779          * Since this must be a VM flag we stop processing once we see
 780          * an argument the launcher would not have processed beyond (such
 781          * as -version or -h), or an argument that indicates the following
 782          * arguments are for the application (i.e. the main class name, or
 783          * the -jar argument).
 784          */
 785         if (i > 0) {
 786             char *prev = argv[i - 1];
 787             // skip non-dash arg preceded by class path specifiers
 788             if (*arg != '-' && IsWhiteSpaceOption(prev)) {
 789                 continue;
 790             }
 791 
 792             if (*arg != '-' || isTerminalOpt(arg)) {
 793                 return;
 794             }
 795         }


 814                  *   that could store the address.
 815                  */
 816                 char * pbuf = (char*)JLI_MemAlloc(pbuflen);
 817 
 818                 JLI_Snprintf(pbuf, pbuflen, "%s%d=%s", NMT_Env_Name, JLI_GetPid(), value);
 819                 retval = JLI_PutEnv(pbuf);
 820                 if (JLI_IsTraceLauncher()) {
 821                     char* envName;
 822                     char* envBuf;
 823 
 824                     // ensures that malloc successful
 825                     envName = (char*)JLI_MemAlloc(pbuflen);
 826                     JLI_Snprintf(envName, pbuflen, "%s%d", NMT_Env_Name, JLI_GetPid());
 827 
 828                     printf("TRACER_MARKER: NativeMemoryTracking: env var is %s\n",envName);
 829                     printf("TRACER_MARKER: NativeMemoryTracking: putenv arg %s\n",pbuf);
 830                     envBuf = getenv(envName);
 831                     printf("TRACER_MARKER: NativeMemoryTracking: got value %s\n",envBuf);
 832                     free(envName);
 833                 }

 834             }

 835         }

 836     }
 837 }
 838 
 839 /* copied from HotSpot function "atomll()" */
 840 static int
 841 parse_size(const char *s, jlong *result) {
 842   jlong n = 0;
 843   int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
 844   if (args_read != 1) {
 845     return 0;
 846   }
 847   while (*s != '\0' && *s >= '0' && *s <= '9') {
 848     s++;
 849   }
 850   // 4705540: illegal if more characters are found after the first non-digit
 851   if (JLI_StrLen(s) > 1) {
 852     return 0;
 853   }
 854   switch (*s) {
 855     case 'T': case 't':


1383         } else if (JLI_StrCmp(arg, "-verifyremote") == 0) {
1384             AddOption("-Xverify:remote", NULL);
1385         } else if (JLI_StrCmp(arg, "-noverify") == 0) {
1386             AddOption("-Xverify:none", NULL);
1387         } else if (JLI_StrCCmp(arg, "-ss") == 0 ||
1388                    JLI_StrCCmp(arg, "-oss") == 0 ||
1389                    JLI_StrCCmp(arg, "-ms") == 0 ||
1390                    JLI_StrCCmp(arg, "-mx") == 0) {
1391             char *tmp = JLI_MemAlloc(JLI_StrLen(arg) + 6);
1392             sprintf(tmp, "-X%s", arg + 1); /* skip '-' */
1393             AddOption(tmp, NULL);
1394         } else if (JLI_StrCmp(arg, "-checksource") == 0 ||
1395                    JLI_StrCmp(arg, "-cs") == 0 ||
1396                    JLI_StrCmp(arg, "-noasyncgc") == 0) {
1397             /* No longer supported */
1398             JLI_ReportErrorMessage(ARG_WARN, arg);
1399         } else if (JLI_StrCCmp(arg, "-splash:") == 0) {
1400             ; /* Ignore machine independent options already handled */
1401         } else if (ProcessPlatformOption(arg)) {
1402             ; /* Processing of platform dependent options */


1403         } else {
1404             /* java.class.path set on the command line */
1405             if (JLI_StrCCmp(arg, "-Djava.class.path=") == 0) {
1406                 _have_classpath = JNI_TRUE;
1407             }
1408             AddOption(arg, NULL);
1409         }
1410     }
1411 
1412     if (*pwhat == NULL && --argc >= 0) {
1413         *pwhat = *argv++;
1414     }
1415 
1416     if (*pwhat == NULL) {
1417         *pret = 1;
1418     } else if (mode == LM_UNKNOWN) {
1419         /* default to LM_CLASS if -m, -jar and -cp options are
1420          * not specified */
1421         if (!_have_classpath) {
1422             SetClassPath(".");


2260        * the callee
2261        */
2262       return (ret != 0) ? ret : rslt;
2263     }
2264 }
2265 
2266 static void
2267 DumpState()
2268 {
2269     if (!JLI_IsTraceLauncher()) return ;
2270     printf("Launcher state:\n");
2271     printf("\tFirst application arg index: %d\n", JLI_GetAppArgIndex());
2272     printf("\tdebug:%s\n", (JLI_IsTraceLauncher() == JNI_TRUE) ? "on" : "off");
2273     printf("\tjavargs:%s\n", (_is_java_args == JNI_TRUE) ? "on" : "off");
2274     printf("\tprogram name:%s\n", GetProgramName());
2275     printf("\tlauncher name:%s\n", GetLauncherName());
2276     printf("\tjavaw:%s\n", (IsJavaw() == JNI_TRUE) ? "on" : "off");
2277     printf("\tfullversion:%s\n", GetFullVersion());
2278 }
2279 




























2280 /*
2281  * A utility procedure to always print to stderr
2282  */
2283 void
2284 JLI_ReportMessage(const char* fmt, ...)
2285 {
2286     va_list vl;
2287     va_start(vl, fmt);
2288     vfprintf(stderr, fmt, vl);
2289     fprintf(stderr, "\n");
2290     va_end(vl);
2291 }
2292 
2293 /*
2294  * A utility procedure to always print to stdout
2295  */
2296 void
2297 JLI_ShowMessage(const char* fmt, ...)
2298 {
2299     va_list vl;
< prev index next >