I've read so many Q&A here about tools available to find out unused JARs, such as:
My question here is, are there any impacts (such as loading of classes into memory, performance, etc.) of having unused JARs in the classpath either at compile time or run time? Question applies to both running as a Standalone program and Web Server (Apache Tomcat), though I initially thought about only Standalone programs.
NOTE: I'm running JDK 6u32 (64-bit).
Are there any impacts (such as loading of classes into memory, performance, etc.) of having unused JARs in the classpath either at compile time or run time?
There is going to be a small impact. When the class loader (or the compiler's equivalent) starts, it has to read the index of each JAR file to find out what classes are in each JAR. If you've got unnecessary JARs on the classpath, the classloader has more work to do, and will (at least temporarily) use more memory to cache the indexes.
This applies to all kinds of Java application. Other related impacts are:
The question that you didn't ask ... is whether these impacts are significant. The answer is "Generally No" ... but the more useless stuff you have on the classpath, etc, the greater the impact is going to be.
IMO, a more important problem with having unused JARs on the classpath is that it is likely to increase your maintenance overheads. For example, if there are old unused JAR files that happen to have vulnerabilities, someone is liable to spend time checking and upgrading those JARs in response to a security scan ... not realizing that it doesn't affect actual security, and is (arguably1) a waste of time.
1 - It is certainly a waste of time in the sense that you wouldn't have needed to expended if the unused JAR had been removed in the first place!