Class Resources


  • public final class Resources
    extends Object
    Provides helper methods to work with resources.
    Since:
    2.0
    • Method Detail

      • getResource

        public static URL getResource​(String resourceName)
        Returns a URL pointing to resourceName if the resource is found using the context class loader. In simple environments, the context class loader will find resources from the class path. In environments where different threads can have different class loaders, for example app servers, the context class loader will typically have been set to an appropriate loader for the current thread.

        In the unusual case where the context class loader is null, the class loader that loaded this class (Resources) will be used instead.

        Parameters:
        resourceName - the name of the resource
        Returns:
        the URL of the resource
        Throws:
        IllegalArgumentException - if the resource is not found