Class OwnResFirstClassLoader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class OwnResFirstClassLoader
    extends URLClassLoader
    An URLClassLoader that tries to retrieve resources within the own classpaths first before asking the parent classloader. Therefore the own resources are preferred to the ones of the parent classloader.
    Author:
    Ulrich Kreher
    • Constructor Detail

      • OwnResFirstClassLoader

        public OwnResFirstClassLoader​(URL[] urls,
                                      ClassLoader parent)
        Constructs a new classloader for the designated URLs. This is similar to an URLClassLoader except that resources are tried to retrieve from these URLs before delegating to the designated parent classloader.
        Parameters:
        urls - The URLs from which to load classes and resources.
        parent - The parent class loader for delegation.
        See Also:
        SecurityManager.checkCreateClassLoader()