Friday, July 31, 2009

How to shrink java project to get rid of unused classes and packages?

I use open source application, by defining the jar as a classpath. In in my main class I use only one feature from a number of others the open source application provides. I tried to determine the classes and got mixed in the huge amount of classes and packages. Tried obfuscators but got error messages. Has anyone experienced such issue before and how resolved. Does Eclipse or Jbuilder provide any serious tool for that except viewing class trees, etc.? Thanks

How to shrink java project to get rid of unused classes and packages?
Well, there is a very old project call JARG (see URL below) that apparently has this capability.





The one thing to note though: Java code can dynamically generate strings and execute them. That means that there is no way for any tool to be 100% sure ahead of time what classes will be needed at runtime (for example, my code could ask the user to enter a classname and a method, which the program could then load and invoke).


No comments:

Post a Comment