String () { final String programName = "hg"; final String unixExec = "hg"; final String winExec = "hg.exe"; String exec = ExecutableHelper.findEnvValue(programName, Collections.singletonList(HG_EXECUTABLE_ENV)); if (exec != null) { return exec; } exec = findInSources(programName, unixExec, winExec); if (exec != null) { return exec; } throw new IllegalStateException(programName + " executable not found."); }