Reducing jar dependencies?

P

pelakh

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
 
T

Thomas Hawtin

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
 
R

Roedy Green

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.
 
I

iamfractal

(e-mail address removed) 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top