I have inherited an RMI client-server app, which I am extending and
maintaining. Unfortunately, the current build procedure creates a
single jar for the entire app, which then resides both on the client
and the server. This means that when even the smallest tweaks are made
on the client GUI (or server persistance, etc), both places have to be
updated.
I would like to partition the app into 3 jars (client, server and a
shared jar for the classes used in the RMI interface). Is there a tool
that would help me visualize the different class-class dependency and
assist me in finding the cleanest way to perform this split?
Thanks for any help.
Boris
Thomas Hawtin - 18 Oct 2005 19:11 GMT
> I would like to partition the app into 3 jars (client, server and a
> shared jar for the classes used in the RMI interface). Is there a tool
> that would help me visualize the different class-class dependency and
> assist me in finding the cleanest way to perform this split?
Without having to get hold of any tools you are not familiar with:
o Delete all the class files.
o Compile the server supplying only the names of the names of the root
classes. javac will compile all necessary java files, but no more.
Recursively
o Recursively list all the (outer) class files, with file paths. (find
. -name "*.class" | grep -v '\$' will do it on UNIX. On DOS, dir can do
something similar.)
o Use sed, or search & replace of your favourite editor, to convert
the list into a shell/batch file to move the .java files.
o Repeat the preceding states for the client.
o On a copy of the source, move out all the server files. The leaves
client-only files.
o From the moved file directory, move out all the client files. The
leaves server-only files. The last directory include files common to
both client and server.
If you only want to do it to class files, you could automate this
process slightly modified.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Roedy Green - 18 Oct 2005 19:24 GMT
>I would like to partition the app into 3 jars (client, server and a
>shared jar for the classes used in the RMI interface). Is there a tool
>that would help me visualize the different class-class dependency and
>assist me in finding the cleanest way to perform this split?
look into ant genjar. See http://mindprod.com/jgloss/genjar.html
What you can do is tell genjar the root class for the client and
server jars and it will collect all the dependent classes.
All you need do then is see what is common (jar -t ) sort diff and
split them off into a third jar.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
iamfractal@hotmail.com - 19 Oct 2005 08:41 GMT
pelakh@yahoo.com skrev:
> Is there a tool
> that would help me visualize the different class-class dependency and
> assist me in finding the cleanest way to perform this split?
>
> Thanks for any help.
> Boris
This won't assist the split, but will show class dependencies per
package - click "Download Fractality" at:
www.EdmundKirwan.com/servlet/fractal/frac-page130.html
After loading the jar select Analysis View -> Dependencies on, and
double click packages of interest. (And check Analysis View -> Circular
dependencies to see whether you're staring at a monster.)
.ed
--
www.EdmundKirwan.com - Home of The Fractal Class Composition.