public static List<String> getResourceNamesFromJAR(String path,
			String extension, Class<?> clazz) throws IOException {
		CodeSource src = clazz.getProtectionDomain().getCodeSource();
		List<String> testResources = new ArrayList<String>();
		ZipInputStream zip = null;

		if (src != null) {
			URL jar = src.getLocation();
			ZipEntry ze = null;

			try {
				zip = new ZipInputStream(jar.openStream());

				while ((ze = zip.getNextEntry()) != null) {
					String entryName = ze.getName();

					if (entryName.startsWith(path)
							&& entryName.endsWith("." + extension)) {
						testResources.add(entryName);
					}
				}
			} finally {
				closeQuietly(zip);
			}
		} else {
			throw new IOException("Unable to get code source for "
					+ clazz.getSimpleName());
		}

		return testResources;
	}
public static List < String > getResourceNamesFromJAR ( String path , String extension , Class < ? > clazz ) throws IOException { CodeSource src = clazz . getProtectionDomain ( ) . getCodeSource ( ) ; List < String > testResources = new ArrayList < String > ( ) ; ZipInputStream zip = null ; if ( src != null ) { URL jar = src . getLocation ( ) ; ZipEntry ze = null ; try { zip = new ZipInputStream ( jar . openStream ( ) ) ; while ( ( ze = zip . getNextEntry ( ) ) != null ) { String entryName = ze . getName ( ) ; if ( entryName . startsWith ( path ) && entryName . endsWith ( "." + extension ) ) { testResources . add ( entryName ) ; } } } finally { closeQuietly ( zip ) ; } } else { throw new IOException ( "Unable to get code source for " + clazz . getSimpleName ( ) ) ; } return testResources ; }
Retrieves a set of resource names from a JAR file (the code source for
the given Java class)

@param path

@param extension
@param clazz
@return the list of resource names from a JAR file
@throws IOException