I'm working on a web application where I have dependencies on two different jars containing two different versions of the same class. The jar files are supplied by an external vendor and cannot be changed.
I've created a custom class loader, which first first tries to load classes from a specific set of jars, and if that fails it just loads the class in the standard manner. This makes it possible to ensure that a specific set of jar files are always used first. This solves my problem.
However, I was wondering if there was an easier way.