Find which jar file contains a class

Very handy to know… how to find out which jar file to include in a project to make your imports work. The answer is simple… search which jar file implements that class. I use the following bash function for this:

for f in `find . -name '*.jar'`; do echo $f && jar tvf $f | grep -i "$1"; done

This will search all jars in all subfolders for the text provided in $1!

Hope it helps!