Reputation: 1581
If I have a java class and:
- I compile the class and include it in a jar, A
- compile separately the same class and include it in a different jar, B
(I know it's not politically right to do this...etc)
(the compilation is done against the same jdk, on the same machine)
If I put these two jars in the same war - can I get class loading problems?
Upvotes: 0
Views: 59
Reputation: 47699
Two ways to get into trouble:
But having the same (from an external attributes standpoint) class twice in your classpath is not a problem -- the first one in the JAR search order will always be loaded.
Upvotes: 1
Reputation: 6233
No. You'll simply get the first copy it finds. If they're in the same package, you'll effectively never see that other class.
And it's not "politically" wrong to do this. It's fundamentally a bug.
Upvotes: 1