Sdk () { if (myInternalJdk == null) { Path javaHome = Paths.get(SystemProperties.getJavaHome()); if (JdkUtil.checkForJre(javaHome) && !JdkUtil.checkForJdk(javaHome)) { // handle situation like javaHome="<somewhere>/jdk1.8.0_212/jre" (see IDEA-226353) Path javaHomeParent = javaHome.getParent(); if (javaHomeParent != null && JdkUtil.checkForJre(javaHomeParent) && JdkUtil.checkForJdk(javaHomeParent)) { javaHome = javaHomeParent; } } String versionName = JdkVersionDetector.formatVersionString(JavaVersion.current()); myInternalJdk = JavaSdk.getInstance().createJdk(versionName, javaHome.toAbsolutePath().toString(), !JdkUtil.checkForJdk(javaHome)); } return myInternalJdk; }