Reputation: 241
My project includes two jars (xyz-jre7.jar and xyz-jre8.jar) in the classpath, which contain classes with identical names. During runtime, my program seems to pick up the correct jar and classes with both JRE 7 and 8. Internally, how does Java know which class to use? In which file(s) are these checks made?
Upvotes: 4
Views: 315
Reputation: 10064
The default ClassLoader load classes from jar files in non deterministic order. If there are two or more classes with same fully qualified name, the first one loaded wins.
Application server usually have custom ClassLoaders
Upvotes: 1