Filter out JRE installations on MacOS

java_home tool shows also JRE installations located at
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" path.
They should not be used as there are no javac and other tools there.
This commit is contained in:
Pavel Punegov
2021-05-25 12:35:03 +03:00
committed by Space
parent 9b8ae8ce4f
commit 6e901e3785
+7 -2
View File
@@ -117,8 +117,13 @@ fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
for (rex in macOsJavaHomeOutRegexes) {
val matchResult = rex.matchEntire(line)
if (matchResult != null) {
addIfBetter(project, matchResult.groupValues[1], matchResult.groupValues[0], File(matchResult.groupValues[3]))
break
val jdkHomeDir = File(matchResult.groupValues[3])
// Filter out JRE installed at /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/
// and shown by the java_home tool
if (!jdkHomeDir.path.contains("JavaAppletPlugin.plugin")) {
addIfBetter(project, matchResult.groupValues[1], matchResult.groupValues[0], jdkHomeDir)
break
}
}
}
}