509 util.error("bad.arg", e.getMessage()); 510 return false; 511 } 512 513 JavahProcessor p = new JavahProcessor(g); 514 t.setProcessors(Collections.singleton(p)); 515 516 boolean ok = t.call(); 517 if (p.exit != null) 518 throw new Util.Exit(p.exit); 519 return ok; 520 521 } 522 523 static StandardJavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { 524 return JavahFileManager.create(dl, log); 525 } 526 527 private void showHelp() { 528 log.println(getMessage("main.usage", progname)); 529 for (Option o: recognizedOptions) { 530 if (o.isHidden()) 531 continue; 532 String name = o.aliases[0].substring(1); // there must always be at least one name 533 log.println(getMessage("main.opt." + name)); 534 } 535 String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" }; 536 for (String o: fmOptions) { 537 if (fileManager.isSupportedOption(o) == -1) 538 continue; 539 String name = o.substring(1); 540 log.println(getMessage("main.opt." + name)); 541 } 542 log.println(getMessage("main.usage.foot")); 543 } 544 545 private void showVersion(boolean full) { 546 log.println(version(full)); 547 } 548 549 private static final String versionRBName = "com.sun.tools.javah.resources.version"; 550 private static ResourceBundle versionRB; 551 552 private String version(boolean full) { 553 String msgKey = (full ? "javah.fullVersion" : "javah.version"); 554 String versionKey = (full ? "full" : "release"); 555 // versionKey=product: mm.nn.oo[-milestone] 556 // versionKey=full: mm.mm.oo[-milestone]-build 557 if (versionRB == null) { 558 try { 559 versionRB = ResourceBundle.getBundle(versionRBName); 560 } catch (MissingResourceException e) { 561 return getMessage("version.resource.missing", System.getProperty("java.version")); | 509 util.error("bad.arg", e.getMessage()); 510 return false; 511 } 512 513 JavahProcessor p = new JavahProcessor(g); 514 t.setProcessors(Collections.singleton(p)); 515 516 boolean ok = t.call(); 517 if (p.exit != null) 518 throw new Util.Exit(p.exit); 519 return ok; 520 521 } 522 523 static StandardJavaFileManager getDefaultFileManager(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { 524 return JavahFileManager.create(dl, log); 525 } 526 527 private void showHelp() { 528 log.println(getMessage("main.usage", progname)); 529 530 for (Option o: recognizedOptions) { 531 if (o.isHidden()) 532 continue; 533 String name = o.aliases[0].substring(1); // there must always be at least one name 534 log.println(getMessage("main.opt." + name)); 535 } 536 537 String[] fmOptions = { 538 "--module-path", "--system", 539 "--class-path", "-classpath", "-cp", 540 "-bootclasspath" 541 }; 542 543 for (String o: fmOptions) { 544 if (fileManager.isSupportedOption(o) == -1) 545 continue; 546 String name = o.replaceAll("^-+", "").replaceAll("-+", "_"); 547 log.println(getMessage("main.opt." + name)); 548 } 549 550 log.println(getMessage("main.usage.foot")); 551 } 552 553 private void showVersion(boolean full) { 554 log.println(version(full)); 555 } 556 557 private static final String versionRBName = "com.sun.tools.javah.resources.version"; 558 private static ResourceBundle versionRB; 559 560 private String version(boolean full) { 561 String msgKey = (full ? "javah.fullVersion" : "javah.version"); 562 String versionKey = (full ? "full" : "release"); 563 // versionKey=product: mm.nn.oo[-milestone] 564 // versionKey=full: mm.mm.oo[-milestone]-build 565 if (versionRB == null) { 566 try { 567 versionRB = ResourceBundle.getBundle(versionRBName); 568 } catch (MissingResourceException e) { 569 return getMessage("version.resource.missing", System.getProperty("java.version")); |