// 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) 
package version;

public class Test {
	private static void test(Class c) throws InstantiationException, IllegalAccessException {
		System.out.println(c.getName());
		System.out.println(c.getClassLoader());
		System.out.println(c.getPackage().getName());
		System.out.println(c.getPackage().getImplementationVersion());
		System.out.println(c.getPackage().getImplementationVendor());
		Object o1 = c.newInstance();
		System.out.println(o1);
		Object o2 = c.newInstance();
		System.out.println(o2);
	}
	public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
		ClassLoader cl1 = new VersionClassLoader("C:\\code-arne\\ver", "test/", "1.0");
		Class c1 = Class.forName("test.Test", true, cl1);
		test(c1);
		ClassLoader cl2 = new VersionClassLoader("C:\\code-arne\\ver", "test/", "2.0");
		Class c2 = Class.forName("test.Test", true, cl2);
		test(c2);
		ClassLoader cl3 = new VersionClassLoader("C:\\code-arne\\ver", "test/", "3.0");
		Class c3 = Class.forName("test.Test", true, cl3);
		test(c3);
	}
}
