Here you can find the source of getFileNamesInJar(File source, String folder, String extension)
public static ArrayList<String> getFileNamesInJar(File source, String folder, String extension)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class Main { public static ArrayList<String> getFileNamesInJar(File source, String folder, String extension) { ArrayList<String> list = new ArrayList(); try {/*from w w w .ja va2 s. c om*/ JarFile jarFile = new JarFile(source); Enumeration e = jarFile.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(extension) || !je.getName().startsWith(folder)) { continue; } list.add(je.getName()); } jarFile.close(); } catch (Throwable t) { t.printStackTrace(); } return list; } }