Class ClasspathURLStreamHandler

  • All Implemented Interfaces:

    public class ClasspathURLStreamHandler
    extends Object
    implements URLStreamHandlerFactory
    A URLStreamHandlerFactory which can handle classpath: URI schemes. It will attempt to load resources from the thread's context classloader (if it exists) and then fallback to the system classloader. The factory must be registered as the URL stream handler factory using the register() method. On Java 9+, this class is available as a URLStreamHandlerProvider service loader implementation which, if present in the boot classpath, will be automatically registered and used by the URL class.
    Tristan Tarrant <>
    • Constructor Detail

      • ClasspathURLStreamHandler

        public ClasspathURLStreamHandler()
    • Method Detail

      • register

        public static void register()
        Registers this URL handler as the JVM-wide URL stream handler. It can only be invoked once in the lifecycle of an application. Refer to the URL documentation for restrictions and alternative methods of registration.