Here is the scenario
Let say I have a class A.java which is dependent on class B.java.
public Class A{
public B b=new B();
}
public Class B{
//Some business logic...
}
And there is application X which uses only class A(somewhere inside X there is new A()
). So
1) can I create 2 jars, one which contain A.class and another jar which contain B.class, add these 2 jars in application ?
2) can I create a one jar which contain only A.class add that jar in application and provide B.class to application on run-time (lets assuming, its possible to inject B.class on runtime)
Note:Adding these 2 classes in single jar is not an option
so as I understand,Class A is compile time dependency of application X and Class B is runtime dependency, correct ?
In point 1 and 2, When I am saying "add jar in application", what exactly I am doing, am I adding those jar in buildpath or classpath of application X ? probably someone can help me in understanding the difference between these "paths", I always gets confused.