tags:

views:

204

answers:

3

I need to deploy only the referenced classes in a very limited environment as A data carousel for Interactive TV. Bandwidth is expensive and .jar files are not supported.

+2  A: 

Sounds like you need a dependency analyzer. This one might do the trick.

ProGuard might be even better, since it can also shrink existing .class files.

Michael Myers
Stop stealing from my post dude :)
willcodejavaforfood
I'd apologize, but I didn't even know anyone else had posted until I finished my edit. :)
Michael Myers
+1 For ProGuard - it will do the job, removing unused classes and methods and output a new JAR with the unused code removed, to boot.
Software Monkey
@mmyers - no worries mate :)
willcodejavaforfood
+6  A: 

Check out ProGuard which is an obfuscator that will list code and classes that are not used. Obfuscating itself usually results in a smaller foot print.

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

willcodejavaforfood
One thing to watch out for is that ProGuard can't handle any classes that you only access via reflection. If you have any, you will need to add them to a special list (can't remember the exact details).
Matt Solnit
+1  A: 

Perhaps you could load a custom class loader which does support jar files or ideally pack200 files.

Peter Lawrey
pack200 is rather resource intensive on extration
Mike Miller