I am working on a java application that uses classes form a 3rd party library. Currently I am including the entire library in the jar for distribution. While this solution works, it results in a rather large jar file.

My application uses only a small fraction of the classes in the library. I know which classes I reference directly from my code, but these classes in turn reference other classes in the library. Is there an easy way to find out which classes I need to include in my jar for distribution and which parts of the library I don't need to include?

In case this is relevant, I am using NetBeans IDE 5.0 for this project. Does it have the functionality to pack in only the required classes? If so, I was unable to find it.

Thanks!

Martin