dev691
dev691

Reputation: 1114

How Java class are loaded from the same directory?

How a java application launched with the classpath: "lib/*" will choose witch class to load if the lib directory contains several JAR with the same class? The comportment will be the same every time? With different servers?

Upvotes: 0

Views: 41

Answers (1)

JB Nizet
JB Nizet

Reputation: 692231

From the documentation:

The order in which the JAR files in a directory are enumerated in the expanded class path is not specified and may vary from platform to platform and even from moment to moment on the same machine. A well-constructed application should not depend upon any particular order. If a specific order is required, then the JAR files can be enumerated explicitly in the class path.

Upvotes: 2

Related Questions