FileUtil { public static Set<String> getJarFilePathsForResources(ClassLoader _cl, String[] _resources) { final Set<String> jar_paths = new HashSet<String>(); if (_cl != null && _resources != null) { for (String r : _resources) { final URL u = _cl.getResource(r); if (u != null) { final String jar_path = FileUtil.getJarFilePath(u.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 testGetJarFilePathsForResources() { final String[] resources = new String[] {"LICENSE-junit.txt"}; final Set<String> jars = FileUtil.getJarFilePathsForResources(FileUtil.class.getClassLoader(), resources); assertTrue(jars.size() == 1); }