// the class name without the path component
String classNameToLoad =withoutExtJavaStr.substring(withoutExtJavaStr.lastIndexOf(File.separatorChar)+1, withoutExtJavaStr.length());
int javaNameIdx = javaFile.indexOf(classNameToLoad);
String pathToAdd = javaFile.substring(0, javaNameIdx-1); // path to add the the extension class loader class path
extClassLoader.extendClassPath(pathToAdd); // append the path
try { // try to load the class
Class loadedClass = extClassLoader.loadClass(classNameToLoad);
Method m = null;
// used for invoking the main method of a Java class