Q:

Search or list Java classes in classpath (ncluding JARS) via command line

I really like the javap command line program to decompile and inspect classes however most of the time I can't recollect the fully qualified package name of a class:
javap java.nio.file.Files

If I don't know the package name then I resort to using Google. Is there a built-in java program or slick Linux command that could search and list all the matching packages of a given class name?

A:

Searches all jars:
find <path> -name "*.jar" -exec jar -tf {} \; | grep "/<classname>\.class\$"

example:
find ~/.ivy2/ -name "*.jar" -exec jar -tf {} \; | grep "/Filter\.class\$"

output:
javax/servlet/Filter.class
javax/servlet/Filter.class
javax/servlet/Filter.class
org/scalatest/Filter.class
org/scalatest/Filter.class
org/fusesource/scalate/filter/Filter.class
org/fusesource/scalate/filter/Filter.class
scala/tools/scalap/scalax/rules/Filter.class
org/apache/ivy/util/filter/Filter.class
com/foursquare/fongo/impl/Filter.class
com/foursquare/fongo/impl/Filter.class
com/foursquare/fongo/impl/Filter.class
shapeless/Filter.class

I'm not personally in love with this solution.
To search all class files just use find:
find <path> -name "*.class"

