related: manage conflict on java classpath
also related: Java Classloader - how to reference different versions of a jar
I have two jar files in my which in each own has it own dependency included in jar file but both of them is in different version.
a.jar -> has c.class/c2.class/c3.class/.. version 0.3 in it
b.jar -> has c.class/c2.class/c3.class/.. version 1.0 in it
But when I tried to use both of them in the same project. It seems like it only use c.class from one jar but not another. This turn out to be a problem since API is very different in both version. Is there anyway to tell them to use a c.class just from its respective jar ? I can't modified a.jar and b.jar here.
btw. After quick search it seems like people suggest OSGI and classloader but I know next to nothing about it which should be the quickest way to deal with it ? (already read a little bit about classloader but still not sure how to use it).
EDIT: I prefer to use original library they bundle with since I already evaluated those two jar separately (they are text mining tools with same back-end but the version is very different). Now I want to integrate both of them into one and try to make the environment close to original as possible. Right now I follow Travis Webb's solution but I still wonder why the jar don't separate both set of library.