Class CommandLineBuilder

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

public class CommandLineBuilder extends Object
  • Constructor Details

    • CommandLineBuilder

      public CommandLineBuilder()
    • CommandLineBuilder

      public CommandLineBuilder(String bin)
  • Method Details

    • findExecutable

      public static File findExecutable(File root, String path)
    • findJavaBin

      public static String findJavaBin()
    • quote

      @Deprecated public static String quote(String arg)
      Deprecated.
      no replacement, quoting is done by toQuotedString() now.
      Perform an optional quoting of the argument, being intelligent with spaces and quotes as needed. If a subString is set in quotes it won't the subString won't be escaped.
      Parameters:
      arg - the argument to quote
      Returns:
      the quoted and escaped argument
    • addArg

      public void addArg(String arg)
      Add a simple argument to the command line.

      Will quote arguments that have a space in them.

      Parameters:
      arg - the simple argument to add
    • addEqualsArg

      public void addEqualsArg(String name, String value)
      Similar to addArg(String) but concats both name + value with an "=" sign, quoting were needed, and excluding the "=" portion if the value is undefined or empty.
         addEqualsArg("-Dname", "value") = "-Dname=value"
         addEqualsArg("-Djetty.home", "/opt/company inc/jetty (7)/") = "-Djetty.home=/opt/company\ inc/jetty\ (7)/"
         addEqualsArg("-Djenkins.workspace", "/opt/workspaces/jetty jdk7/") = "-Djenkins.workspace=/opt/workspaces/jetty\ jdk7/"
         addEqualsArg("-Dstress", null) = "-Dstress"
         addEqualsArg("-Dstress", "") = "-Dstress"
       
      Parameters:
      name - the name
      value - the value
    • addRawArg

      public void addRawArg(String arg)
      Add a simple argument to the command line.

      Will NOT quote/escape arguments that have a space in them.

      Parameters:
      arg - the simple argument to add
    • getArgs

      public List<String> getArgs()
    • toString

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

      public String toString(String delim)
    • toQuotedString

      public String toQuotedString()
      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()