I have a small project in my workspace with small number of jars on the classpath.
I need to use a class that exists in a larger project with a heavy classpath.
Hence now logically i need to add that project to the build path as well as as runtime classpath.
But I need to know whether this would result in a performance hit since now the classpath for my smaller project has suddenly got huge just because I need to use a class from the bigger project.
There will be a slight performance hit during app startup as the JVM hunts for the classes to load. But once the needed classes are loaded, there should be no further performance degradation due to the larger classpath. Note that only the classes needed by the app get loaded, no classes that are not used will be loaded.
One thing you could try is to determine exactly which JARs need to be in the classpath - you will probably not need every JAR for the heavy app. A tool such a JBoss Tattletale can help you define this abbreviated classpath.
Giriraj Bhojak wrote:
Did you mean i should add the class i need to a new but smaller project?
I either have the build script to get the dependency out of source control and build it as a separate jar file or simply add it to the source directory of the project I'm working on.
The important thing is to have source control so you can reproduce a build with a particular version of the dependency. If the other project makes substantial changes to your dependency, you could ether end up with a broken dependency or miss out on valuable bug fixes.