List<String> (@NotNull Path jdkHome, boolean isJre) { List<String> result = new ArrayList<>(); if (JdkUtil.isExplodedModularRuntime(jdkHome)) { try { try (DirectoryStream<Path> roots = Files.newDirectoryStream(jdkHome.resolve("modules"))) { for (Path root : roots) { result.add(VfsUtil.getUrlForLibraryRoot(root)); } } } catch (IOException ignore) { } } else if (JdkUtil.isModularRuntime(jdkHome)) { String jrtBaseUrl = JrtFileSystem.PROTOCOL_PREFIX + vfsPath(jdkHome) + JrtFileSystem.SEPARATOR; List<String> modules = readModulesFromReleaseFile(jdkHome); if (modules != null) { for (String module : modules) { result.add(jrtBaseUrl + module); } } else { VirtualFile jrt = VirtualFileManager.getInstance().findFileByUrl(jrtBaseUrl); if (jrt != null) { for (VirtualFile virtualFile : jrt.getChildren()) { result.add(virtualFile.getUrl()); } } } } else { for (Path root : JavaSdkUtil.getJdkClassesRoots(jdkHome, isJre)) { result.add(VfsUtil.getUrlForLibraryRoot(root)); } } Collections.sort(result); return result; }