Have you ever wondered which jar contains a particular class? I often have, and it's not easy to find out. It can help to google it, but it's usually one's own system that matters.

I've had to do this time and again so I wrote this simple utility to help me. It looks recursively in jars for an entry and is case-insensitive if the -i option is used. The usage is simple:

java -jar jarsearch.jar [-i] <root directory> <entry name to search for, e.g. java/awt/Button>

Example usages:

java -jar jarsearch.jar . java/awt/Button

(Look for java.awt.Button in jars under the current directory)

java -jar jarsearch.jar -i . button

(List all jars under the current directory containing string 'button', 'Button', 'BUTTON' etc)

Of course, for ease of use, it would probably be better to wrap the command in a batch file or shell script and place it in your PATH

You can download the jar file HERE

Please support this site using the button below: