Java tutorial
//package com.java2s; import java.io.File; import java.util.Collection; public class Main { private static void walkTreeAndReturnJARS(File dir, Collection<File> dst) { for (File e : dir.listFiles()) { if (e.isDirectory()) walkTreeAndReturnJARS(e, dst); else { if (e.getName().toLowerCase().endsWith(".jar")) { dst.add(e); } } } } }