diff --git a/launcher/java/JavaUtils.cpp b/launcher/java/JavaUtils.cpp index 040fe8210..6c0c60cd3 100644 --- a/launcher/java/JavaUtils.cpp +++ b/launcher/java/JavaUtils.cpp @@ -379,7 +379,9 @@ QList JavaUtils::FindJavaPaths() } } - return addJavasFromEnv(candidates); + candidates = addJavasFromEnv(candidates); + candidates.removeDuplicates(); + return candidates; } #elif defined(Q_OS_MAC) @@ -402,7 +404,9 @@ QList JavaUtils::FindJavaPaths() javas.append(systemLibraryJVMDir.absolutePath() + "/" + java + "/Contents/Home/bin/java"); javas.append(systemLibraryJVMDir.absolutePath() + "/" + java + "/Contents/Commands/java"); } - return addJavasFromEnv(javas); + javas = addJavasFromEnv(javas); + javas.removeDuplicates(); + return javas; } #elif defined(Q_OS_LINUX) @@ -448,7 +452,9 @@ QList JavaUtils::FindJavaPaths() scanJavaDir("/opt/jdks"); // flatpak scanJavaDir("/app/jdk"); - return addJavasFromEnv(javas); + javas = addJavasFromEnv(javas); + javas.removeDuplicates(); + return javas; } #else QList JavaUtils::FindJavaPaths()