开发者

How does JVM deal with duplicate JARs of different versions

Whe开发者_如何学运维n there were duplicate JARs with different versions, the behavior was very inconsistent. Does anyone know how the JVM deals with duplicates?


The classloader searches the classpath in order, and uses the first matching class it finds.


FWIW, this is an example of a larger topic (modularity) that is addressed by OSGi and Project Jigsaw/JSR 294 in JDK 7 Java 9.

Your question is good motivation for the topic: the venerable, simple classpath may have been a good idea at its inception, but it is certainly a pain point in today's age of high dependence on 3rd-party-libraries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜