void () { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); Application application = ApplicationManager.getApplication(); if (propertiesComponent.getBoolean(DEFAULT_JDK_CONFIGURED, false) || application.isUnitTestMode()) return; try { Sdk jdk = ProgressManager.getInstance().runProcessWithProgressSynchronously( this::guessJdk, JavaBundle.message("progress.title.detecting.jdk"), true, null); if (jdk != null) { application.runWriteAction(() -> addJdk(jdk)); } } catch (ProcessCanceledException ignored) { } // If cancelled once, let's avoid subsequent attempts // While this detection is usually fast, on some machines it could be slow for strange reasons. // e.g., JAVA_HOME points to unreachable network drive. In this case, give up further attempts. propertiesComponent.setValue(DEFAULT_JDK_CONFIGURED, true); }