void () { List<Path> files = getRoots(); if (files == null) { return; } try { URL[] urls = files.stream().map(path -> { try { return path.toUri().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } }).toArray(URL[]::new); URLClassLoader auxLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); Thread.currentThread().setContextClassLoader(auxLoader); Thread.currentThread().setContextClassLoader(loadOptimizedLoader(files, auxLoader)); } catch (Exception e) { throw new RuntimeException(e); } }