JARFileFilter implements FileFilter { @Override public boolean accept(File pathname) { String name = pathname.getName(); name = name.toLowerCase(); if (name.endsWith(".jar")) { return true; } return false; }  @Override boolean accept(File pathname);  }
@Test public void test() { JARFileFilter filter = new JARFileFilter(); File a = new File("a.jar"); File b = new File("b.JAR"); File c = new File("c.exe"); Assert.assertTrue(filter.accept(a)); Assert.assertTrue(filter.accept(b)); Assert.assertFalse(filter.accept(c)); }