Class Command


  • public class Command
    extends java.lang.Object
    Since:
    2.7
    • Method Detail

      • create

        public static Command create​(java.lang.String executable)
        Create a command line without any arguments
        Parameters:
        executable -
      • getExecutable

        public java.lang.String getExecutable()
      • getArguments

        public java.util.List<java.lang.String> getArguments()
      • addArgument

        public Command addArgument​(java.lang.String arg)
      • addMaskedArgument

        public Command addMaskedArgument​(java.lang.String arg)
      • addArguments

        public Command addArguments​(java.util.List<java.lang.String> args)
      • addArguments

        public Command addArguments​(java.lang.String[] args)
      • getDirectory

        public java.io.File getDirectory()
      • setDirectory

        public Command setDirectory​(java.io.File d)
        Sets working directory.
      • setEnvironmentVariable

        public Command setEnvironmentVariable​(java.lang.String name,
                                              java.lang.String value)
        Since:
        3.2
        See Also:
        getEnvironmentVariables()
      • getEnvironmentVariables

        public java.util.Map<java.lang.String,​java.lang.String> getEnvironmentVariables()
        Environment variables that are propagated during command execution. The initial value is a copy of the environment of the current process.
        Returns:
        a non-null and immutable map of variables
        Since:
        3.2
      • isNewShell

        public boolean isNewShell()
        true if a new shell should be used to execute the command. The default behavior is to not use a new shell.
        Since:
        3.3
      • setNewShell

        public Command setNewShell​(boolean b)
        Set to true if a new shell should be used to execute the command. This is useful when the executed command is a script with no execution rights (+x on unix). On windows, the command will be executed with cmd /C executable. On other platforms, the command will be executed with sh executable.
        Since:
        3.3
      • toCommandLine

        public java.lang.String toCommandLine()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object