This discussion is archived
6 Replies Latest reply: Jul 2, 2010 6:10 AM by 843804 RSS

In search of java class dependency utility

843802 Newbie
Currently Being Moderated
Folks,
We have developed a J2EE application where the "client" is a java
application. In other words, we have created a JAR file that a user
uses to launch our application. The manifest for this JAR file has a
"Main-Class" attribute, so the following command is used to launch the
(client side of) the application:
java -jar our.jar
Our entire application (both client-side and server-side) consists of
several hundred classes. Our problem is that we don't have an accurate
list of which classes are client-side only, which classes are
server-side only, and which classes are required by both (client-side
and server-side). I want our client-side JAR to only contain classes
required by the client. Currently, we are simply bundling all the
classes into "our.jar".

I have found (and tried) several utilities, including:

http://depfind.sourceforge.net/

http://www.clarkware.com/software/JDepend.html

http://www.horstmann.com/articles/BetterCleaner.html

However, I don't think these are suitable. You need to supply a class
name, and they only tell you the classes that either depend on the
given class, or that the given class depends on. What I want is a
"recursive" dependency finder.

For example, let's say I have class "A". Class "A" depends on class "B"
(in other words, class "A" needs to import class "B"). Now class "B"
depends on class "C" and class "C" depends on class "D". Also, we have
class "E" that depends on class "A" (in other words, class "E" needs to
import class "A").

The tools I mentioned above will only return (at most), classes "B" and
"E" (when I supply them with class "A"), but what I really need them to
return is classes "B","C" and "D" (and not necessarily class "E").

Does anyone know how I can achieve this?

Thanks (in advance),
Avi.