Classpath length and performance - how long is too long?

Folks,Can anyone point me at some information about the releationship between classpath length and jvm performance? Does a long classpath matter? Is there a maximum length?Many thanks,Miles
[217 byte] By [daffinma] at [2007-11-26 16:22:48]
# 1

Hi Miles,

The CLASSPATH System variable length depends on the underlying Operating System. The OS limits the length of the CLASSPATH Variable. As far as I know, in Windows, it is about 1024 characters.

I am not aware of any JVM Performance issues related to the length of a CLASSPATH varaible.

Regards,

Sandeep

Sandeep_Seshana at 2007-7-8 22:46:36 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

There is some relation. I don't know if it has been changed in one of latest jdks, but some time ago every classloader was tried in turn when loading the class - and only way for it to report it is not defining such class was to throw the exception. This means that if you application classes are last in classpath and you have 20 jars before that listed, you may end up with 20 exceptions thrown for every class you load - which adds up pretty fast.

I think that netbeans or eclipse at some point implemented the optimalization to ask the correct classloader for the file and it gave visible difference in startup time.

So yes, it can affect speed of application initialization, but should not affect runtime performance after that.

abiesa at 2007-7-8 22:46:36 > top of Java-index,Java HotSpot Virtual Machine,Specifications...