Loads a native library. Uses {@link LoadPolicy#PREFER_SHIPPED} as the default loading policy.

@param clazz
The class whose classloader should be used to resolve shipped libraries
@param name
The name of the class.
189997
public void loadLibrary(Class<?> clazz, String name) {
        loadLibrary(clazz, name, LoadPolicy.PREFER_SHIPPED);
    }
668261
public static ClassLoader getClassLoader(Class<?> clazz) {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (loader != null) {
            return loader;
        }
        if (clazz != null) {
            loader = clazz.getClassLoader();
            if (loader != null) {
                return loader;
            }
        }
        return ClassLoader.getSystemClassLoader();
    }
99768
public YamlLoader getLoader(String name) {
        for (YamlProperties yamlProp : yamlProps) {
            if (yamlProp.getRoot().containsKey(name)) {
                return yamlProp.getLoader();
            }
        }
        return null;
    }
363807
private Class<?> getImportedClassImpl(final String name) throws UtilEvalError {
        // Try explicitly imported class, e.g. import foo.Bar;
        String fullname = this.importedClasses.get(name);
        // not sure if we should really recurse here for explicitly imported
        // class in parent...
        if (fullname != null) {
            /* Found the full name in imported classes. */
            // Try to make the full imported name
            Class<?> clas = this.classForName(fullname);

            if ( clas != null )
                return clas;

            // Handle imported inner class case
            // Imported full name wasn't found as an absolute class
            // If it is compound, try to resolve to an inner class.
            // (maybe this should happen in the BshClassManager?)
            if (Name.isCompound(fullname))
                try {
                    clas = this.getNameResolver(fullname).toClass();
                } catch (final ClassNotFoundException e) { /* not a class */ }
            Interpreter.debug(
                        "imported unpackaged name not found:", fullname);
            // If found cache the full name in the BshClassManager
            if (clas != null) {
                // (should we cache info in not a class case too?)
                this.getClassManager().cacheClassInfo(fullname, clas);
                return clas;
            }
            // It was explicitly imported, but we don't know what it is.
            // should we throw an error here??
            return null;
        }
        /* Try imported packages, e.g. "import foo.bar.*;" in reverse order of
         * import... (give later imports precedence...) */
        for (final String s: this.importedPackages) {
            final Class<?> c = this.classForName(s + "." + name);
            if (c != null)
                return c;
        }
        final BshClassManager bcm = this.getClassManager();
        /* Try super import if available Note: we do this last to allow
         * explicitly imported classes and packages to take priority. This
         * method will also throw an error indicating ambiguity if it
         * exists... */
        if (bcm.hasSuperImport()) {
            final String s = bcm.getClassNameByUnqName(name);
            if (s != null)
                return this.classForName(s);
        }
        return null;
    }
1223071
public void importClass(final String name) {
        this.importedClasses.put(Name.suffix(name, 1), name);
        this.nameSpaceChanged();
    }
900900
public Class loadClass(final String name, boolean lookupScriptFiles, boolean preferClassOverScript)
            throws ClassNotFoundException, CompilationFailedException {
        return loadClass(name, lookupScriptFiles, preferClassOverScript, false);
    }
19573
protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
		if (this.classLoader == null){
			return Class.forName(clazz);
		}

		return Class.forName(clazz, true, this.classLoader);

	}
949241
public static void loadLibrary(boolean _trySystemLibsFirst, String _libName, String... _searchPathes) {
        if (!isEnabled()) {
            return;
        }

        List<SearchOrder> loadOrder = new ArrayList<>();

        if (_trySystemLibsFirst) {
            loadOrder.add(SearchOrder.SYSTEM_PATH);
        }

        loadOrder.add(SearchOrder.CUSTOM_PATH);
        loadOrder.add(SearchOrder.CLASS_PATH);

        loadLibrary(_libName, loadOrder.toArray(new SearchOrder[] {}), _searchPathes);
    }
938226
public Clazz<?> FindClazz( String name )
	{
		if( clazzz == null )
			return null;

		for( Clazz<?> c : clazzz.values() )
			if( c.getClassName().equals( name ) )
				return c;

		return null;
	}
901368
@FFDCIgnore(ClassNotFoundException.class)
    private Class<?> findClassCommonLibraryClassLoaders(String name) throws ClassNotFoundException {
        for (LibertyLoader cl : delegateLoaders) {
            try {
                return cl.findClass(name);
            } catch (ClassNotFoundException e) {
                // Ignore. Will throw at the end if class is not found.
            }
        }
        // If we reached here, then the class was not loaded.
        throw new ClassNotFoundException(name);
    }
745053
protected synchronized Class loadClass(final String name, boolean resolve) throws ClassNotFoundException {
        Class c = this.findLoadedClass(name);
        if (c != null) return c;
        c = (Class) customClasses.get(name);
        if (c != null) return c;

        try {
            c = oldFindClass(name);
        } catch (ClassNotFoundException cnfe) {
            // IGNORE
        }
        if (c == null) c = super.loadClass(name, resolve);

        if (resolve) resolveClass(c);

        return c;
    }
770187
public static void loadLibrary(String _libName, SearchOrder[] _loadOrder, String... _searchPathes) {
        if (!isEnabled()) {
            return;
        }

        for (SearchOrder order : _loadOrder) {
            if (INSTANCE.findProperNativeLib(order, _libName, _searchPathes) == null) {
                return;
            }
        }
        throw new RuntimeException("Could not load library from any given source: " + Arrays.toString(_loadOrder));
    }
127615
private void deploy(ClassLoader cl, String name) throws Throwable
   {
      if (cl == null)
         throw new IllegalArgumentException("ClassLoader is null");

      if (name == null)
         throw new IllegalArgumentException("Name is null");

      URL url = cl.getResource(name);

      if (url == null)
         throw new IllegalArgumentException("Resource is null");

      log.debugf("Deploying: %s", url);

      kernel.getMainDeployer().deploy(url);
   }
1125811
@Override
    public Class<?> loadClass(String name) throws ClassNotFoundException {
        if (name.equals(bundleName)) {
            // We're loading the base bundle. Good! Let it load.
            return super.loadClass(name);
        } else {
            // We're NOT loading the base bundle, so return null.
            return null;
        }
    }
799286
@SuppressWarnings("rawtypes")
    public static Class loadClass(String name) throws ClassNotFoundException {
        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        return (loader == null) ? Class.forName(name) : loader.loadClass(name);
    }
1293696
public URL getResourceFrom(String name, AbstractClassLoader first) {
		if (name.length() == 0) return null;
		if (name.charAt(0) == '/') name = name.substring(1);
		URL url = null;
    	// try with the first one
    	if (first != null)
   			url = first.getResourceURL(name);
    	// then, try on other libraries
    	if (url == null) {
        	for (int i = 0; i < libs.size(); i++) {
        		AbstractClassLoader cl = libs.get(i);
        		if (cl == first) continue;
       			url = cl.getResourceURL(name);
        		if (url != null) break;
        	}
        }
        if (url == null)
        	url = AppClassLoader.class.getClassLoader().getResource(name);
        return url;
	}
514532
public static Properties loadProperties(final Class<?> clasz, final String filename) {
        checkNotNull("clasz", clasz);
        checkNotNull("filename", filename);

        final String path = getPackagePath(clasz);
        final String resPath = path + "/" + filename;
        return loadProperties(clasz.getClassLoader(), resPath);

    }