public static IVMInstall getVMInstall(String name) {
   if (name != null) {
     IVMInstall[] installs = VMUtil.getAllVMInstances();
     for (int i = 0; i < installs.length; i++) {
       if (installs[i].getName().equals(name)) return installs[i];
     }
   }
   return JavaRuntime.getDefaultVMInstall();
 }
  /**
   * Get the default VMInstall name using the available info in the config, using the JavaProject if
   * available.
   *
   * @param configuration Launch configuration to check
   * @return name of the VMInstall
   * @throws CoreException thrown if there's a problem getting the VM name
   */
  public static String getDefaultVMInstallName(ILaunchConfiguration configuration)
      throws CoreException {
    IJavaProject javaProject = JavaRuntime.getJavaProject(configuration);
    IVMInstall vmInstall = null;
    if (javaProject != null) {
      vmInstall = JavaRuntime.getVMInstall(javaProject);
    }

    if (vmInstall != null) {
      return vmInstall.getName();
    }

    return VMUtil.getDefaultVMInstallName();
  }