I am distributing a Java application as a JAR but it depends on a few extra Apache libraries. All told the libraries increase the size of the JAR sixfold. I don't need the entire library and I want to remove anything that is not needed by my code.
Is there a way to identify the 开发者_Python百科classes that are needed? I could go through the source for all the classes I called and check their dependencies but that is just a pain considering the libraries are from 6 separate JARs.
You can use ProGuard to eliminate any unneeded classes within the distributed jars. You might need to customize the process to handle dependencies that cannot be discovered at compile time (e.g. due to reflection).
精彩评论