public static String findJar(String[] jarSearchDirs, String jarPrefix) throws IllegalStateException {
        String maxBaseName = null;
        File   maxFile     = null;
        for (String jarSearchDir: jarSearchDirs) {
            File dir     = new File(jarSearchDir);
            File[] files = dir.listFiles();
            if (files == null) continue;

            for (File file : files) {
                String baseName = file.getName();
                if (file.isFile() && baseName.endsWith(".jar") && baseName.startsWith(jarPrefix)) {
                    if (maxBaseName == null || baseName.compareTo(maxBaseName) > 0) {
                        maxBaseName = baseName;
                        maxFile     = file;
                    }
                }
            }
        }

        if (maxFile == null)
            throw new IllegalStateException("Could not find " + jarPrefix + " in " + join(jarSearchDirs, File.pathSeparator));
        else
            return maxFile.getPath();
    }