Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

#Classfinder Build Status Coverage Status

Classpath, folder, zip and jar scanner to find specific classes. Classes can be filtered with various filters to find only those that match some specific criteria. If presented with a folder to search, Classfinder will recursively search it for .class, .jar and .zip files which are all also scanned.

Classfinder is an ideal library to create your own lightweight frameworks or tools, where you need to dynamically find implementations of some interface or initiate objects. See examples below.

Once you've found the needed classes you can initiate new objects by using Class.forName(classInfo.getClassName()).newInstance()

This library is based on I extracted the ClassFinder related portion of that library and updated it to work with asm 4.1 (there's binary incompatibility between asm 3.x and 4.x). I then added tests and started refactoring / further development.


The project is available at Maven Central Repository

Just add a dependency like so:


#Filters The following filters are available:

Aggergate filters - used to combine different concrete filters together with logical operators (AND, OR, NOT)


Concrete filters - used to filter classes either by their modifiers (abstract, interface), name or other criteria

  • - matches classes that are assignable to the base class
  • - matches classes by name
  • - matches only interfaces
  • - matches only abstract classes
  • - matches classes that are annotated with the given annotation


Find all non abstract non interface classes implementing SomeInterface in someFolder

NB! Note the use of simple factory methods, these are only for convenience and readability, if you don't like them, you can always just create new ClassFilters directly

ClassFinder finder = new ClassFinder().add(someFolder);

ClassFilter filter = And.allOf(
    Not.a(new Interface()),
    Not.a(new AbstractClass()));

Collection<ClassInfo> foundClasses = finder.findClasses(filter);

Find all test classes in myJar.jar

ClassFinder finder = new ClassFinder().add(Paths.get("/path/to/myJar.jar").toFile());

ClassFilter filter = Or.anyOf(

Collection<ClassInfo> testClasses = finder.findClasses(filter);

Find all @Deprecated classes in classpath

ClassFinder finder = new ClassFinder().addClasspath();
Collection<ClassInfo> deprecated = finder.findClasses(Annotated.with(Deprecated.class));

#Acknowlegement This product includes software developed by Brian M. Clapper (, That software is copyright (c) 2004-2007 Brian M. Clapper.


Classpath, folder, zip and jar scanner to find and filter specific classes




No packages published