Building custom Java library
I've noticed that a lot of Javascript/jQuery libraries allow developers to customize the .js fil开发者_StackOverflow社区e, thus including only the bare minimum functionality to save bandwidth/page load times.
Now when I'm distributing my Java library to clients, is there a way to do the same? I don't like forcing clients to have to include a large library in their application if they're only going to be using a few classes.
Ideally everything would be packaged into a nice JAR file.
EDIT: Something similar to this: http://flowplayer.org/tools/download/index.html
Most obfuscators (including the popular ProGuard) can (and by default will) eliminate unused methods and classes from the jar. They do a nice job of checking that apparently unused classes are not used indirectly by the main program.
This is one of the things ProGuard does. From the website:
ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes.
精彩评论