String (String fileName) { try { final String jarPath = PathUtil.getJarPathForClass(GroovyLanguage.class); if (new File(jarPath).isFile()) { //jar; distribution mode return new File(jarPath, "../" + fileName).getCanonicalPath(); } //else, it's directory in out, development mode return new File(jarPath, "conf/" + fileName).getCanonicalPath(); } catch (IOException e) { throw new RuntimeException(e); } }