| Author |
How to find all imported classes in java file?
|
hiren parghi
Greenhorn
Joined: Dec 17, 2006
Posts: 4
|
|
I am working on a big application. In that application there are many packages and each packages have many java files. I want to compile a single java file that has many dependants classes in application.I want to make a jar file of all the dependant classes. How can i know how many dependant classes are there for java file??? For Example. I have ClassA,ClassB,CLassC,ClassD,ClassE. and all classes are in different packages. ClassA has imported ClassB ClassB has imported ClassC ClassC has imported ClassD ClassD has imported ClassE now to compile class ClassA we require ClassB,ClassC,ClassD,ClassE. Here we can can find all dependaent classes for ClassA because its a small example but in big application we can not search each references explicitly.. So please if anybody knows any tricks or any tools to find dependant classes please tell me.. Thanks in Advance
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
"hiren01it", please check your private messages. You can see them by clicking My Private Messages.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
See if FatJar does what you need. It might drag in whole jars when you only need a few classes. I use the JDepends dependency tool plus a script that reads through the report to extract simple "a depends on b" data. I write a DOT file for GraphViz but you could surely make a jar or zip script. None of these things will find classes you load through Class.forName(xxx).newInstance(). I tend to do quite a bit of that with factories configured through properties or whatever.
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
"hiren p" - please check your private messages again.
|
 |
 |
|
|
subject: How to find all imported classes in java file?
|
|
|