// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;

public class TestX {
    public static void main(String[] args) throws Exception {
        ClassLoader v1 = new URLClassLoader(new URL[] { (new File("v1.jar")).toURI().toURL() });
        HasTest o1 = (HasTest)Class.forName("X", true, v1).newInstance();
        o1.test();
        ClassLoader v2 = new URLClassLoader(new URL[] { (new File("v2.jar")).toURI().toURL() });
        HasTest o2 = (HasTest)Class.forName("X", true, v2).newInstance();
        o2.test();
    }
}
