public static void setOptions(@NotNull List<? extends Pair<@NotNull String, @Nullable String>> _options) throws IOException {
    Path file = getUserOptionsFile();
    if (file == null) {
      throw new IOException("The IDE is not configured for using custom VM options (jb.vmOptionsFile=" + System.getProperty("jb.vmOptionsFile") + ')');
    }

    List<String> lines = Files.exists(file) ? new ArrayList<>(Files.readAllLines(file, getFileCharset())) : new ArrayList<>();
    List<Pair<String, @Nullable String>> options = new ArrayList<>(_options);
    boolean modified = false;

    for (ListIterator<String> il = lines.listIterator(lines.size()); il.hasPrevious(); ) {
      String line = il.previous().trim();
      for (Iterator<Pair<String, String>> io = options.iterator(); io.hasNext(); ) {
        Pair<String, String> option = io.next();
        if (line.startsWith(option.first)) {
          if (option.second == null) {
            il.remove();
            modified = true;
          }
          else {
            String newLine = option.first + option.second;
            if (!newLine.equals(line)) {
              il.set(newLine);
              modified = true;
            }
            io.remove();
          }
          break;
        }
      }
    }

    for (Pair<String, String> option : options) {
      if (option.second != null) {
        lines.add(option.first + option.second);
        modified = true;
      }
    }

    if (modified) {
      NioFiles.createDirectories(file.getParent());
      ourUserFileLock.writeLock().lock();
      try {
        Files.write(file, lines, getFileCharset());
      }
      finally {
        ourUserFileLock.writeLock().unlock();
      }
    }
  }
public static void setOptions(@NotNull List<? extends Pair<@NotNull String, @Nullable String>> _options)