tags:

views:

785

answers:

3

Is there a way to find all the class dependencies of a java Main class?

I have been manually sifting through the imports of the Main class and it's imports but then realised that, because one does not have to import classes that are in the same package, I was putting together an incomplete list.

This should be recursive (perhaps to a defined depth).

A: 

in intellij idea you have the nifty dependency structure matrix. you can explore package- and class-level dependencies perfectly. if you like it simpler, you have a dependency viewer as well, but htere you can only see first-order dependencies.

Andreas Petersson
A: 

I just found Class Dependency Analyzer, download, install configure and 10 min's later I have a complete class Dependency list.

Ron Tuffin
+1  A: 

It can be eaily done with just javac. Dekete your class files and then compile the main class. javac will recursively compile any classes it needs (providing you don't hide package private classes/interfaces in strangely named files). Of course, this doesn't cover any recursive hacks.

Tom Hawtin - tackline