Sdk (@NotNull JavaSdkVersion version) { JavaSdk javaSdk = JavaSdk.getInstance(); Sdk candidate = null; for (Sdk sdk : ProjectJdkTable.getInstance().getSdksOfType(javaSdk)) { String homePath = sdk.getHomePath(); if (homePath == null || !javaSdk.isValidSdkHome(homePath)) continue; JavaSdkVersion v = javaSdk.getVersion(sdk); if (v == version) { return sdk; // exact match } if (candidate == null && v != null && v.isAtLeast(version)) { candidate = sdk; // first suitable } } return candidate; }