public Process createProcess() throws ExecutionException {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Executing [" + getCommandLineString() + "]");
    }

    List<String> commands;
    try {
      checkWorkingDirectory();

      if (StringUtil.isEmptyOrSpaces(myExePath)) {
        throw new ExecutionException(
            IdeBundle.message("run.configuration.error.executable.not.specified"));
      }

      commands = CommandLineUtil.toCommandLine(myExePath, myProgramParams.getList());
    } catch (ExecutionException e) {
      LOG.warn(e);
      throw e;
    }

    try {
      ProcessBuilder builder = new ProcessBuilder(commands);
      setupEnvironment(builder.environment());
      builder.directory(myWorkDirectory);
      builder.redirectErrorStream(myRedirectErrorStream);
      return builder.start();
    } catch (IOException e) {
      LOG.warn(e);
      throw new ProcessNotCreatedException(e.getMessage(), e, this);
    }
  }
 /**
  * Returns string representation of this command line.<br>
  * Warning: resulting string is not OS-dependent - <b>do not</b> use it for executing this command
  * line.
  *
  * @param exeName use this executable name instead of given by {@link #setExePath(String)}
  * @return single-string representation of this command line.
  */
 public String getCommandLineString(@Nullable final String exeName) {
   final List<String> commands = new ArrayList<String>();
   if (exeName != null) {
     commands.add(exeName);
   } else if (myExePath != null) {
     commands.add(myExePath);
   } else {
     commands.add("<null>");
   }
   commands.addAll(myProgramParams.getList());
   return ParametersList.join(commands);
 }
 /**
  * Prepares command (quotes and escapes all arguments) and returns it as a newline-separated list
  * (suitable e.g. for passing in an environment variable).
  *
  * @return command as a newline-separated list.
  */
 @NotNull
 public String getPreparedCommandLine() {
   String exePath = myExePath != null ? myExePath : "";
   return StringUtil.join(CommandLineUtil.toCommandLine(exePath, myProgramParams.getList()), "\n");
 }