JDK-4778648 : (launcher) javaw should report the same startup error messages as java
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-11-14
  • Updated: 2002-11-20
  • Resolved: 2002-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The javaw command does not display many of the error messages the java command writes out to stderr (contrary to the spec); javaw should display a message box containing the error messages java encounters during startup.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis mantis-b08
14-06-2004

SUGGESTED FIX diffs for src/share/bin/java.c: ------- java.c ------- 60d59 < int status = 0; 106a106,108 > /* Report an error message to stderr or a window as appropriate */ > extern void ReportErrorMessage(char * message); > extern void ReportErrorMessage2(char * format, char * string); 151a154,156 > /* Error message to print or display */ > char * message = "Fatal exception occured. Program will exit."; > 173c178 < start = CounterGet(); --- > start = CounterGet(); 175,176c180 < status = 1; < exit(6); --- > exit(6); 179,181c183,185 < end = CounterGet(); < printf("%ld micro seconds to LoadJavaVM\n", < (long)(jint)Counter2Micros(end-start)); --- > end = CounterGet(); > printf("%ld micro seconds to LoadJavaVM\n", > (long)(jint)Counter2Micros(end-start)); 203d206 < status = 2; 218c221,222 < status = 2; --- > ReportErrorMessage("Could not parse the command arguments. " > "Program will exit."); 235,236c239 < fprintf(stderr, "Could not create the Java virtual machine.\n"); < status = 3; --- > ReportErrorMessage("Could not create the Java virtual machine."); 247a251 > message = NULL; 257a262 > message = NULL; 292,294c297,302 < fprintf(stderr, "Failed to load Main-Class manifest attribute " < "from\n%s\n", jarfile); < goto leave; --- > const char * format = "Failed to load Main-Class manifest " > "attribute from\n%s\n"; > message = (char*)MemAlloc((strlen(format) + strlen(jarfile)) * > sizeof(char)); > sprintf(message, format, jarfile); > goto leave; 304c312 < status = 4; --- > message = "Could not find the main class. Program will exit."; 311c319,322 < fprintf(stderr, "Failed to load Main Class: %s\n", classname); --- > const char * format = "Failed to load Main Class: %s\n"; > message = (char *)MemAlloc((strlen(format) + strlen(classname)) * > sizeof(char) ); > sprintf(message, format, classname); 322c333 < status = 4; --- > message = "Could not find the main class. Program will exit."; 335c346,347 < fprintf(stderr, "No main method found in specified class.\n"); --- > message = "No main method found in specified class. " > "Program will exit."; 337d348 < status = 5; 349d359 < status = 6; 359d368 < status = 6; 365,366c374 < fprintf(stderr, "Main method not public.\n"); < status = 8; --- > message = "Main method not public."; 395c403 < fprintf(stderr, "Could not detach main thread.\n"); --- > message = "Could not detach main thread."; 398a407 > message = NULL; 401a411,412 > if(message != NULL) > ReportErrorMessage(message); 497c508,509 < fprintf(stderr, "Error: Unable to resolve VM alias %s\n", knownVMs[jvmidx].alias); --- > ReportErrorMessage2("Error: Unable to resolve VM alias %s.", > knownVMs[jvmidx].alias); 513c525 < fprintf(stderr, "Error: %s VM not supported\n", jvmtype); --- > ReportErrorMessage2("Error: %s VM not supported.", jvmtype); 900c912,913 < fprintf(stderr, "Error: the -J option should not be followed by a space.\n"); --- > ReportErrorMessage("Error: the -J option should not be " > "followed by a space."); 954c967 < fprintf(stderr, "Can't determine application home\n"); --- > ReportErrorMessage("Can't determine application home."); 1171c1184 < fprintf(stderr, "Error: could not open `%s'\n", jvmCfgName); --- > ReportErrorMessage2("Error: could not open `%s'.", jvmCfgName); diffs for src/solaris/bin/java_md.c: ------- java_md.c ------- 2c2 < * @(#)java_md.c 1.29 02/10/31 --- > * %W% %E% 61a62,63 > void ReportErrorMessage(char * message); > void ReportErrorMessage2(char * format, char * string); 795a798,800 > void ReportErrorMessage(char * message) { > fprintf(stderr, "%s\n", message); > } 796a802,806 > void ReportErrorMessage2(char * format, char * string) { > fprintf(stderr, format, string); > fprintf(stderr, "\n"); > } > 806a817 > diffs for src/windows/bin/java.c ------- java_md.c ------- 34a35,36 > void ReportErrorMessage(char * message); > void ReportErrorMessage2(char * format, char * string); 62c64 < fprintf(stderr, "Error: could not find Java 2 Runtime Environment.\n"); --- > ReportErrorMessage("Error: could not find Java 2 Runtime Environment."); 68c70 < fprintf(stderr, "Error: no known VMs. (check for corrupt jvm.cfg file)\n"); --- > ReportErrorMessage("Error: no known VMs. (Check for corrupt jvm.cfg file.)"); 75c77,82 < fprintf(stderr, "Error: no `%s' JVM at `%s'.\n", *_jvmtype, jvmpath); --- > char * message=NULL; > const char * format = "Error: no `%s' JVM at `%s'.\n"; > message = (char *)MemAlloc((strlen(format)+strlen(*_jvmtype)+ > strlen(jvmpath)) * sizeof(char)); > sprintf(message,format, *_jvmtype, jvmpath); > ReportErrorMessage(message); 115c122,123 < if (debug) printf("JRE path is %s\n", path); --- > if (debug) > printf("JRE path is %s\n", path); 155c163 < fprintf(stderr, "Error loading: %s\n", jvmpath); --- > ReportErrorMessage2("Error loading: %s.", (char *)jvmpath); 165c173 < fprintf(stderr, "Error: can't find JNI interfaces in: %s\n", jvmpath); --- > ReportErrorMessage2("Error: can't find JNI interfaces in: %s.", (char *)jvmpath); 204d211 < extern int status; 209d215 < char* message; 221,245d226 < switch (status) { < case 1: < message = "Could not load the Java virtual machine. Program will exit!"; < break; < case 2: < message = "Could not parse the command arguments. Program will exit!"; < break; < case 3: < message = "Could not initialize the Java virtual machine. Program will exit!"; < break; < case 4: < message = "Could not find the main class. Program will exit!"; < break; < case 5: < message = "Could not find the main method. Program will exit!"; < break; < default: < message = NULL; < break; < } < if (message) { < MessageBox(NULL, message, "Java Virtual Machine Launcher", < (MB_OK|MB_ICONSTOP|MB_APPLMODAL)); < } < 358a340,372 > void ReportErrorMessage(char * message) { > #ifdef JAVAW > if(message != NULL) { > MessageBox(NULL, message, "Java Virtual Machine Launcher", > (MB_OK|MB_ICONSTOP|MB_APPLMODAL)); > } > #else > fprintf(stderr, "%s\n", message); > #endif > } > > void ReportErrorMessage2(char * format, char * string) { > /* > * The format argument must be a printf format string with one %s > * argument, which is passed the string argument. > */ > #ifdef JAVAW > size_t size; > char * message; > size = strlen(format) + strlen(string); > message = (char*)MemAlloc(size*sizeof(char)); > sprintf(message, (const char *)format, string); > > if(message != NULL) { > MessageBox(NULL, message, "Java Virtual Machine Launcher", > (MB_OK|MB_ICONSTOP|MB_APPLMODAL)); > } > #else > fprintf(stderr, (const char *)format, string); > fprintf(stderr, "\n"); > #endif > } > 361a376 >
11-06-2004

EVALUATION The javaw command should be fixed accordingly. ###@###.### 2002-11-13
13-11-2002