private String verifyLoad(String target, int flags, boolean expect)
			throws ClassNotFoundException, java.io.IOException, java.net.URISyntaxException, NoSuchMethodException,
				IllegalAccessException, java.lang.reflect.InvocationTargetException
	{
		boolean hack = ((flags & F_CLDHACK) != 0);
		boolean sysload = ((flags & F_SYSLOAD) != 0);
		String failmsg = "";
		String targetjar = target+".jar";
		String targetclass = "greytest."+target;
		ClassLoader prev_cld = DynLoader.getClassLoader();
		//make sure not yet loaded
		try {
			Class.forName(targetclass);
			org.junit.Assert.fail("Target class already loaded at system level - "+targetjar+":"+targetclass);
		} catch (ClassNotFoundException ex) {}
		try {
			Class.forName(targetclass, true, prev_cld);
			org.junit.Assert.fail("Target class already loaded in current context - "+targetjar+":"+targetclass);
		} catch (ClassNotFoundException ex) {}
		try {
			DynLoader.loadClass(targetclass);
			org.junit.Assert.fail("Target class already loaded in DynLoader - "+targetjar+":"+targetclass);
		} catch (ClassNotFoundException ex) {}

		// Now load the JAR and verify we can access its member class
		boolean prevhack = DynLoader.CLDHACK;
		DynLoader.setField(DynLoader.class, "CLDHACK", Boolean.valueOf(hack), null);
		String loadpath = getResourcePath(targetjar, getClass());
		String cp = loadpath+" "+DynLoader.CPDLM+"  "+loadpath;  //double up to test duplicates detection and add white space
		cp += DynLoader.CPDLM+DynLoader.CPDLM;  //empty path elements
		cp += DynLoader.CPDLM+"/tmpx2/yyydir/n0nzushf1le";  //missing file
		cp += DynLoader.CPDLM+"/tmpx2/yyydir/n0nzushf1le/";  //missing file that looks like a directory spec
		java.util.List<java.net.URL> newcp = DynLoader.load(cp);
		org.junit.Assert.assertTrue(newcp != null && newcp.size() == 1);
		assertPath(loadpath, newcp.get(0));
		ClassLoader cld = DynLoader.getClassLoader();
		org.junit.Assert.assertTrue(hack ? cld == prev_cld : cld != prev_cld);
		DynLoader.setField(DynLoader.class, "CLDHACK", Boolean.valueOf(prevhack), null);
		boolean success;
		String diag = "";

		try {
			Class<?> clss = null;
			if (sysload) {
				clss = Class.forName(targetclass);
			} else {
				clss = Class.forName(targetclass, true, cld);
			}
			Object obj = clss.newInstance();
			org.junit.Assert.assertEquals(targetclass, obj.getClass().getName());
			// verify that our own class resolver can access any class the above forName() calls can
			org.junit.Assert.assertSame(clss, DynLoader.loadClass(targetclass));
			success = expect;
		} catch (Throwable ex) {
			success = !expect;
			diag = " - "+ex.toString();
		}
		if (!success) {
			String label = target+"/hack="+hack+"/sys="+sysload+"/load="+(diag.length()==0);
			failmsg = label+"; ";
			System.out.println("ERROR on "+targetjar+":"+targetclass+" - "+label+diag);
		}
		return failmsg;
	}