If I have the same class contain several jars, can I forcefully indicate in the code that I want to load this class from a particular jar?
|
1 answer
It depends on what you mean by "the same class":
- they have the same name, but different package - the class is always loaded by the full name of the class (taking into account the name of the package) - everything is clear;
- they have the same name and the same package - the one that is found first will be loaded, and the one that gets first in the classpath will be found first (most likely for everything in the order of connecting jar files)
UPDATE : useful link - Manage the classpath variable with JWhich .
- Same name and same package, of course. - angry
|