Search code examples
javaclassloader

Tools for finding all dependencies in Java jars


Are there any tools that can be given a classpath or folder, and will search through all the .jar files looking for references to a particular class?

It would have saved me a day of searching in order to resolve this kind of problem.

In my case I had to find out where a rogue reference to a class was coming from, as it was stopping JBoss from starting correctly due to a NoClassDefFoundError. I suppose I am looking for this:

java -jar magicbullet.jar /path/to/search com.myproject.DodgyClass
Searching...
com.problematic.Otherclass in /path/to/search/dodgy.jar implements com.myproject.DodgyClass

Or similar. If not, I'll write one.


Solution

  • Use Tattletale - http://www.jboss.org/tattletale. It helps you create an index which is very handy to search for classes etc.