private Class load(String name) {
        String classname = name.substring(0, name.length() - ".class".length());

        if (classname.startsWith("/")) {
            classname = classname.substring(1);
        }
        classname = classname.replace('/', '.');

        try {
            final Class<?> cls = Class.forName(classname);
            cls.getMethod("main", new Class[] { String[].class });
            if (!getClass().equals(cls)) {
                return cls;
            }
        } catch (
            NoClassDefFoundError // class has unresolved dependencies
            | ClassNotFoundException // class not in classpath
            | NoSuchMethodException // class does not have a main method
            | UnsupportedClassVersionError e
        ) { // unsupported version
            return null;
        }
        return null;
    }
Load a class specified by a file- or entry-name

@param name
           name of a file or entry
@return class file that was denoted by the name, null if no class or does
        not contain a main method
jme3-examples/src/main/java/jme3test/TestChooser.java