org.kohsuke.args4j.CmdLineException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(72)

本文整理了Java中org.kohsuke.args4j.CmdLineException.getLocalizedMessage()方法的一些代码示例,展示了CmdLineException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CmdLineException.getLocalizedMessage()方法的具体详情如下:
包路径:org.kohsuke.args4j.CmdLineException
类名称:CmdLineException
方法名:getLocalizedMessage

CmdLineException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

public static void main(final String[] args) {
  Arguments arguments = new Arguments();
  try {
    CmdLineParser parser = new CmdLineParser(arguments);
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    System.out.println("Error: " + e.getLocalizedMessage());
    return;
  }
  start(arguments);
}

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

public static void main(final String[] args) {
  Arguments arguments = new Arguments();
  try {
    CmdLineParser parser = new CmdLineParser(arguments);
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    System.out.println("Error: " + e.getLocalizedMessage());
    return;
  }
  start(arguments);
}

代码示例来源:origin: Audiveris/audiveris

private static void processCli (String[] args)
{
  try {
    // First get the provided parameters if any
    cli = new CLI(WellKnowns.TOOL_NAME);
    cli.parseParameters(args);
  } catch (CmdLineException ex) {
    logger.warn("Error in command line: {}", ex.getLocalizedMessage(), ex);
    logger.warn("Exiting ...");
    // Stop the JVM, with failure status (1)
    Runtime.getRuntime().exit(1);
  }
}

代码示例来源:origin: crashinvaders/gdx-texture-packer-gui

public static void main(final String[] args) {
  Arguments arguments = new Arguments();
  try {
    CmdLineParser parser = new CmdLineParser(arguments);
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    System.out.println("Error: " + e.getLocalizedMessage());
    return;
  }
  switch (arguments.launcher) {
    case Arguments.LAUNCHER_AWT: {
      System.out.println("AWT launcher is starting");
      AwtFrameLauncher.start(arguments);
      break;
    }
    case Arguments.LAUNCHER_GL_SURFACE: {
      System.out.println("GL surface launcher is starting");
      GLSurfaceLauncher.start(arguments);
      break;
    }
    default:
      throw new IllegalStateException("Unknown launcher name: " + arguments.launcher);
  }
}

代码示例来源:origin: boundary/zoocreeper

System.err.println(e.getLocalizedMessage());

代码示例来源:origin: boundary/zoocreeper

System.err.println(e.getLocalizedMessage());

代码示例来源:origin: biz.aQute.bnd/org.osgi.impl.bundle.repoindex.cli

parser.parseArgument(args);
} catch (CmdLineException e) {
  err.printf("Error during command-line parsing: %s%n", e.getLocalizedMessage());
  commandLineOptions.help = true;

代码示例来源:origin: OpenNMS/newts

public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  CmdLineParser parser = new CmdLineParser(cmdLine);
  try {
    parser.parseArgument(args);
  }
  catch (CmdLineException e) {
    System.err.println(e.getLocalizedMessage());
    usage(parser, System.err);
    System.exit(1);
  }
  // Help requested
  if (cmdLine.needHelp()) {
    usage(parser, System.out);
    System.exit(0);
  }
  // Configuration file does not exist.
  if (!new File(cmdLine.getConfigFilename()).isFile()) {
    System.err.printf("No such file: %s%n", cmdLine.getConfigFilename());
    System.exit(1);
  }
  File pidFile = new File(cmdLine.getPidFilename());
  // Daemonize?
  if (cmdLine.isDaemon()) {
    new Daemon().withMainArgs(args).withPidFile(pidFile).daemonize();
  }
  new NewtsService().run(new String[] { "server", cmdLine.getConfigFilename() });
}

代码示例来源:origin: org.opennms.newts/newts-rest

public static void main(String[] args) throws Exception {
  CommandLine cmdLine = new CommandLine();
  CmdLineParser parser = new CmdLineParser(cmdLine);
  try {
    parser.parseArgument(args);
  }
  catch (CmdLineException e) {
    System.err.println(e.getLocalizedMessage());
    usage(parser, System.err);
    System.exit(1);
  }
  // Help requested
  if (cmdLine.needHelp()) {
    usage(parser, System.out);
    System.exit(0);
  }
  // Configuration file does not exist.
  if (!new File(cmdLine.getConfigFilename()).isFile()) {
    System.err.printf("No such file: %s%n", cmdLine.getConfigFilename());
    System.exit(1);
  }
  File pidFile = new File(cmdLine.getPidFilename());
  // Daemonize?
  if (cmdLine.isDaemon()) {
    new Daemon().withMainArgs(args).withPidFile(pidFile).daemonize();
  }
  new NewtsService().run(new String[] { "server", cmdLine.getConfigFilename() });
}

代码示例来源:origin: nlpie/biomedicus

parser.parseArgument(args);
} catch (CmdLineException e) {
 System.err.println(e.getLocalizedMessage());
 System.err.println(
   "java edu.umn.biomedicus.vocabulary.VocabularyInitializer [options...]");

代码示例来源:origin: Audiveris/audiveris

@Test
public void testRunError ()
    throws Exception
{
  System.out.println("\n+++ testRunError");
  String[] args = new String[]{"-run", "fooBar"};
  try {
    instance.parseParameters(args);
    fail();
  } catch (CmdLineException ex) {
    System.out.println(ex.getMessage());
    System.out.println(ex.getLocalizedMessage());
    assertTrue(ex.getMessage().contains("java.lang.ClassNotFoundException"));
  }
}

代码示例来源:origin: Audiveris/audiveris

@Test
public void testStepEmpty ()
    throws Exception
{
  System.out.println("\n+++ testStepEmpty");
  String[] args = new String[]{"-step"};
  try {
    instance.parseParameters(args);
    fail();
  } catch (CmdLineException ex) {
    System.out.println(ex.getMessage());
    System.out.println(ex.getLocalizedMessage());
    assertTrue(ex.getMessage().contains("-step"));
  }
}

相关文章