String (@NotNull String programName, @NotNull String unixExec, @NotNull String winExec, @NotNull Collection<String> envs) { String exec = findEnvValue(programName, envs); if (exec != null) { return exec; } File fileExec = PathEnvironmentVariableUtil.findInPath(SystemInfo.isWindows ? winExec : unixExec); if (fileExec != null) { return fileExec.getAbsolutePath(); } throw new IllegalStateException(programName + " executable not found. " + (envs.size() > 0 ? "Please define a valid environment variable " + envs.iterator().next() + " pointing to the " + programName + " executable." : "")); }