Is there a tool to detect unneeded jar-files?
For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable.
I realize that reflection might complicate things, but I could live with a tool that ignored reflection. Except for that it seems like a relatively simple problem to solve.
If there is no such tool, what is best practices for deciding which dependencies are needed? It seems to be that it must be a common problem.