FileUtil { public static Set<String> getJarFilePaths(URLClassLoader _cl) { final Set<String> jar_paths = new HashSet<String>(); final URL[] urls = _cl.getURLs(); log.info( "Class loader search path contains [" + urls.length + "] items: Search for configurations in JAR files"); for (int i = 0; i < urls.length; i++) { final String jar_path = FileUtil.getJarFilePath(urls[i].toString()); if (jar_path != null) { jar_paths.add(jar_path); } } return jar_paths; }  static String getFileExtension(File _file); static boolean hasFileExtension(Path _p, String[] _extensions); static String toString(Set<Path> _paths, String _sep); static Path createTmpDir(String _prefix); static boolean isAccessibleFile(String _arg); static boolean isAccessibleFile(Path _arg); static final boolean isAccessibleDirectory(Path _dir); static final boolean isAccessibleDirectory(File _dir); static final boolean isAccessibleDirectory(String _dir); static final void createDirectory(Path _p); static String getFileName(String _file_path); static String getFileName(String _file_path, boolean _keep_ext); static String getCharsetName(); static Charset getCharset(); static Path copyFile(Path _source_file, Path _target_dir); static String readFile(String _p); static String readFile(Path _p); static String readInputStream(InputStream _is, Charset _cs); static byte[] readInputStream(InputStream _is); static final void writeToFile(File _f, String _content); static final Path writeToTmpFile(String _filename, String _suffix, String _content); static final void writeToFile(File _f, byte[] _content); static Set<Path> getPaths(String[] _paths); static Path getPath(String _path, boolean _create); static Path getPath(String _path); static final String getSHA1(File _file); static final String getDigest(File _file, DigestAlgorithm _alg); static String getJarFilePath(Class<?> _clazz); static String getJarFilePath(String _url); static Set<String> getJarFilePathsForResources(ClassLoader _cl, String[] _resources); static Set<String> getJarFilePaths(URLClassLoader _cl); static Boolean isZipped(File _f);  }
@Test public void testGetJarFilePaths() { final ClassLoader cl = FileUtil.class.getClassLoader(); if (cl instanceof URLClassLoader) { final Set<String> jars = FileUtil.getJarFilePaths((URLClassLoader) cl); assertTrue(!jars.isEmpty()); } }