< prev index next >

src/java.base/share/classes/jdk/internal/loader/BootLoader.java

Print this page

@@ -63,11 +63,19 @@
         UNNAMED_MODULE = SharedSecrets.getJavaLangAccess().defineUnnamedModule(null);
         setBootLoaderUnnamedModule0(UNNAMED_MODULE);
     }
 
     // ServiceCatalog for the boot class loader
-    private static final ServicesCatalog SERVICES_CATALOG = ServicesCatalog.create();
+    private static final ServicesCatalog SERVICES_CATALOG;
+    static {
+        ArchivedClassLoaders archivedClassLoaders = ArchivedClassLoaders.get();
+        if (archivedClassLoaders != null) {
+            SERVICES_CATALOG = archivedClassLoaders.servicesCatalog(null);
+        } else {
+            SERVICES_CATALOG = ServicesCatalog.create();
+        }
+    }
 
     // ClassLoaderValue map for the boot class loader
     private static final ConcurrentHashMap<?, ?> CLASS_LOADER_VALUE_MAP
         = new ConcurrentHashMap<>();
 
< prev index next >