From 8e1337d603c4c66501b0a7bb34e31c154e9c7d86 Mon Sep 17 00:00:00 2001 From: Henry Le Grys Date: Sat, 23 Apr 2022 19:49:04 +0100 Subject: [PATCH] Disregard Java runtimes that don't have a bin folder --- .../skcraft/launcher/launch/runtime/JavaRuntimeFinder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaRuntimeFinder.java b/launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaRuntimeFinder.java index 456a07577..01ecf2efe 100644 --- a/launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaRuntimeFinder.java +++ b/launcher/src/main/java/com/skcraft/launcher/launch/runtime/JavaRuntimeFinder.java @@ -43,6 +43,7 @@ public static List getAvailableRuntimes() { // Add system Javas runtimeFinder.getCandidateJavaLocations().stream() .map(JavaRuntimeFinder::getRuntimeFromPath) + .filter(Objects::nonNull) .forEach(entries::add); // Add extra runtimes @@ -95,6 +96,11 @@ public static JavaRuntime getRuntimeFromPath(File target) { binFolder = new File(target, "jre/bin"); } + if (!binFolder.isDirectory()) { + // No bin folder, this isn't a usable install + return null; + } + JavaReleaseFile release = JavaReleaseFile.parseFromRelease(releaseFile.getParentFile()); if (release == null) { // Make some assumptions...