I have two versions of a Java library model.jar
, each with the same set of classes (but different implementations). I want to write a Java class that imports some classes from one version, and imports some from the other version.
I know I can include both in compilation by giving them different names:
javac -cp model.jar;model2.jar MyClass.java
But any import
statement will import the corresponding class from the first .jar file I specify in the classpath.
Can I specify in my import
statement which library to import from, given that the library structure will be the same for both files?