p.load(is);
} catch (IOException e) {
System.err.println(e.getMessage());
System.exit(-1);
}
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(p);
String className = args[0];
//System.out.println("Class to load: " + className);
//Build a ClassLoader
URL[] urls = new URL[args.length-1];
for(int i=1; i<args.length; i++) {
File f = new File(args[i]);
if (!f.exists()) {
System.err.println("Resource '" + args[i] + "' not availlable");
System.exit(-1);
}
//System.out.println("Resource found: " + args[i]);
try {
urls[i-1] = f.toURL();
} catch (MalformedURLException e) {
System.err.println(e.getMessage());
System.exit(-1);
}
}
URLClassLoader ucl = new URLClassLoader(urls, cl);
Class userClass = null;
try {
userClass = ucl.loadClass(className);
} catch (ClassNotFoundException e) {
System.err.println("Problem to load the class '" + className + "'");
System.err.println(e.getMessage());
System.exit(-1);
}
PersistenceManager pm = pmf.getPersistenceManager();
pm.getObjectIdClass(userClass);
System.out.println("Class '" + className
+ "' loaded successfully from the classpath:\n"
+ getClassPath(ucl));
pm.close();