Search in sources :

Example 1 with JdkBundleList

use of com.intellij.util.JdkBundleList in project intellij-community by JetBrains.

the class SwitchBootJdkAction method findJdkPaths.

@NotNull
public static JdkBundleList findJdkPaths() {
    JdkBundle bootJdk = JdkBundle.createBoot();
    JdkBundleList jdkBundleList = new JdkBundleList();
    if (bootJdk != null) {
        jdkBundleList.addBundle(bootJdk, true);
    }
    if (new File(PathManager.getHomePath() + File.separator + bundledJdkFile).exists()) {
        JdkBundle bundledJdk = JdkBundle.createBundle(bundledJdkFile, false, true);
        if (bundledJdk != null) {
            jdkBundleList.addBundle(bundledJdk, true);
        }
    }
    if (SystemInfo.isMac) {
        jdkBundleList.addBundlesFromLocation(STANDARD_JDK_LOCATION_ON_MAC_OS_X, JDK8_VERSION, null);
    } else if (SystemInfo.isLinux) {
        for (String location : STANDARD_JVM_LOCATIONS_ON_LINUX) {
            jdkBundleList.addBundlesFromLocation(location, JDK8_VERSION, null);
        }
    } else if (SystemInfo.isWindows) {
        for (File root : File.listRoots()) {
            if (SystemInfo.is32Bit) {
                jdkBundleList.addBundlesFromLocation(new File(root, STANDARD_JVM_X86_LOCATIONS_ON_WINDOWS).getAbsolutePath(), JDK8_VERSION, null);
            } else {
                jdkBundleList.addBundlesFromLocation(new File(root, STANDARD_JVM_X64_LOCATIONS_ON_WINDOWS).getAbsolutePath(), JDK8_VERSION, null);
            }
        }
    }
    return jdkBundleList;
}
Also used : JdkBundleList(com.intellij.util.JdkBundleList) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) JdkBundle(com.intellij.util.JdkBundle) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 JdkBundle (com.intellij.util.JdkBundle)1 JdkBundleList (com.intellij.util.JdkBundleList)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1