I needed some help in figuring out how to approach the following
problem:
I am trying to use only some parts of a huge application. I am
basically using only one class in my simple application that belongs to
the huge app. Currently, I am having to manually import this class and
then import all its dependencies and check for their dependencies and
so on until all references are resolved. This is painful and I was
wondering if it there was a simple script (ANT or otherwise) that given
a particular java class, analyzes all the packages that are required to
compile it (recursively) successfully, jars them into a single file?
Thank you,
Gknowledge
jfbriere - 02 Dec 2005 21:23 GMT
ANT task:
http://genjar.sourceforge.net/
Regards
Larry Barowski - 03 Dec 2005 02:46 GMT
>I needed some help in figuring out how to approach the following
> problem:
[quoted text clipped - 6 lines]
> a particular java class, analyzes all the packages that are required to
> compile it (recursively) successfully, jars them into a single file?
If you have the source code for the huge application, you
can let javac do the work. Just delete all the class files and
compile that one class you use.
Mike Schilling - 03 Dec 2005 15:39 GMT
>>I needed some help in figuring out how to approach the following
>> problem:
[quoted text clipped - 10 lines]
> can let javac do the work. Just delete all the class files and
> compile that one class you use.
Unless any reflection is done; then all bets are off. This can be more
insidious than it might appear. If, for instance, the app contains an XML
parser found using JAXP's usual search algorithm (i.e. its class is named in
a resource file), that's reflection done inside Java's built-in classes, so
grepping the app for Class.forName won't find it.
Roedy Green - 03 Dec 2005 19:17 GMT
> I am
>basically using only one class in my simple application that belongs to
>the huge app. Currently, I am having to manually import this class and
>then import all its dependencies and check for their dependencies and
>so on until all references are resolved.
see http://mindprod.com/jgloss/genjar.html
With Genjar/ANT, you have to manually add the classForName type
classes, and the getResource resources, but once you have that it will
find the rest of the dependencies. You can specify with flexible
wildcards that select files, directories or directory trees.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.