Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Reducing jar dependencies?

Thread view: 
pelakh@yahoo.com - 18 Oct 2005 17:25 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.