code: public static String addCommand(List<String> cmd, boolean isExecutable) 
    throws IOException {
      StringBuffer command = new StringBuffer();
      for(String s: cmd) {
      	command.append('\'');
        if (isExecutable) {
          // the executable name needs to be expressed as a shell path for the  
          // shell to find it.
      	  command.append(FileUtil.makeShellPath(new File(s)));
          isExecutable = false; 
        } else {
      	  command.append(s);
        }
        command.append('\'');
        command.append(" ");
      }
      return command.toString();
    }
docs: Add quotes to each of the command strings and
  return as a single string
  @param cmd The command to be quoted
  @param isExecutable makes shell path if the first
  argument is executable
  @return returns The quoted string.
  @throws IOException