java - Easy way to use two versions of a jar? -


i have 2 versions of jar different apis (method signatures), 1 new version, other old version.

i'd create application can use either (only 1 @ at time though), can fall-back old jar if needed.

for purpose have 2 versions of relevant class, 1 uses old api, 1 uses new. can use environment variable dictate jar in classpath, , application can use same variable decide class use.

my problem is, how can build both classes in same project, given built against different jars? easy solutions?

do not show jars on classpath. create 2 different urlclassloaders each jar , load class manually classloader1.loadclass or classloader2.loadclass


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -