Class CommandLineBuilder

java.lang.Object
org.eclipse.jetty.start.CommandLineBuilder

public class CommandLineBuilder extends Object
  • Constructor Details

    • CommandLineBuilder

      public CommandLineBuilder()
    • CommandLineBuilder

      public CommandLineBuilder(boolean multiline)
  • Method Details

    • findJavaBin

      public static String findJavaBin()
    • shellQuoteIfNeeded

      public static String shellQuoteIfNeeded(String input)
      This method applies single quotes suitable for a POSIX compliant shell if necessary.
      Parameters:
      input - The string to quote if needed
      Returns:
      The quoted string or the original string if quotes are not necessary
    • addArg

      public void addArg(String arg)
      Add a simple argument to the command line, quoted if necessary.
      Parameters:
      arg - the simple argument to add
    • addArg

      public void addArg(String name, String value)
      Add a "name=value" style argument to the command line with name and value quoted if necessary.
      Parameters:
      name - the name
      value - the value
    • addOption

      public void addOption(String option)
      Adds a "-OPTION" style option to the command line with no quoting, for example `--help`.
      Parameters:
      option - the option
    • addOption

      public void addOption(String option, String name, String value)
      Adds a "-OPTIONname=value" style option to the command line with name and value quoted if necessary, for example "-Dprop=value".
      Parameters:
      option - the option
      name - the name
      value - the value
    • getArgs

      public List<String> getArgs()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toCommandLine

      public String toCommandLine()
      A version of toString() where every arg is evaluated for potential ' (single-quote tick) wrapping.
      Returns:
      the toString but each arg that has spaces is surrounded by ' (single-quote tick)
    • debug

      public void debug()