Modifying Classpath at Runtime

Java - No Comments » - Posted on August, 27 at 4:19 pm

A hackish way of modifying the classpath at runtime can be done in a way described at the java forums Modifying Classpath at Runtime
A cleaner approach is to configure your own classloader and set it as the threads context classloader

URL[] urls=new URL[2];

URLClassLoader classLoader=new URLClassLoader(urls);

Thread.currentThread().setContextClassLoader(classLoader);

This is extremely useful if your unit test cases have dependencies [...]

Read More..>>

Posted in Java | No Comments »