Removing unused classes

What tools are available to remove unused classes and even methods from a set of jars? I’m sick of shipping all my util classes and methods with my game when 50% of the code is not actually loaded or executed.

Cas :slight_smile:

hm, not sure, maybe RefactorIt?

just a thought:
if you run your app with the vm argument -verbose:class it outputs the classname as soon a specific class is loaded. save this output in a textfile, parse it an check all required jars against this file.
now it is possible to write new jars which only include the required classfiles.
i’ve written a little tool which is capable doing this. just a hack, but it worked for me.
the only problem is for classes which get loaded later on execution…
it was actually possible to hack the rt.jar, which size dropped dramatically (but i think it’s not legal to distribute such a hacked rt.jar ;D)

A jar file “shrinker” maybe ! Obfuscators (typically) can do this but with the obvious side-effect. May have to actually give it a go shortly.

Could this be what you’re after? Or perhaps this?

Yay for Ant!