public static void launchCordovaSim(List<String> parameters) {
    Activator.getDefault().countLaunchEvent();
    IVMInstall jvm = BrowserSimLauncher.getSelectedVM();
    if (jvm == null) { // no suitable vm
      ExternalProcessLauncher.showErrorDialog(Messages.CordovaSimLauncher_CORDOVASIM);
    } else {
      String jvmPath = jvm.getInstallLocation().getAbsolutePath();
      String jrePath =
          jvm.getInstallLocation().getAbsolutePath() + File.separator + "jre"; // $NON-NLS-1$

      List<String> bundles = getBundles();

      if (!ExternalProcessLauncher.isGTK2()
          || (!JavaFXUtil.isJavaFXAvailable(jvmPath) && !JavaFXUtil.isJavaFXAvailable(jrePath))) {
        bundles.add("org.jboss.tools.browsersim.javafx.mock"); // $NON-NLS-1$
      }

      ExternalProcessLauncher.launchAsExternalProcess(
          bundles,
          RESOURCES_BUNDLES,
          getJettyBundles(),
          CORDOVASIM_CALLBACKS,
          CORDOVASIM_CLASS_NAME,
          parameters,
          Messages.CordovaSimLauncher_CORDOVASIM,
          jvm);
    }
  }
  public static void launchCordovaSim(
      String projectString,
      String rootFolderString,
      String startPageString,
      Integer port,
      String proxy) {
    List<String> parameters = new ArrayList<String>();
    parameters.add(NOT_STANDALONE);

    IContainer rootFolder = null;
    IProject project = null;
    String cordovaEngineLocation = null;
    String cordovaVersion = null;

    if (projectString != null) {
      project = CordovaSimLaunchParametersUtil.getProject(projectString);

      if (project != null) {
        cordovaEngineLocation = CordovaSimLaunchParametersUtil.getCordovaEngineLocation(project);
        cordovaVersion = CordovaSimLaunchParametersUtil.getCordovaVersion(project);
      }

      if (rootFolderString != null) {
        rootFolder = CordovaSimLaunchParametersUtil.getRootFolder(project, rootFolderString);
      } else {
        rootFolder = CordovaSimLaunchParametersUtil.getDefaultRootFolder(project);
      }
    }

    String actualStartPageString = null;
    if (startPageString != null) {
      actualStartPageString = startPageString;
    } else {
      IResource startPage = CordovaSimLaunchParametersUtil.getDefaultStartPage(project, rootFolder);
      IPath startPagePath = CordovaSimLaunchParametersUtil.getRelativePath(rootFolder, startPage);
      if (startPagePath != null) {
        String startPageFromConfigXml =
            CordovaSimLaunchParametersUtil.getDefaultStartPageFromConfigXml(project);
        String startPageParameters =
            CordovaSimLaunchParametersUtil.getStartPageParameters(startPageFromConfigXml);
        if (startPageParameters != null) {
          actualStartPageString = startPagePath.toString() + startPageParameters;
        } else {
          actualStartPageString = startPagePath.toString();
        }
      }
    }

    if (rootFolder != null && actualStartPageString != null) {
      try {
        if (!ServerStorage.getStorage().containsKey(port) && ServerUtil.isPortAvailable(port)) {
          Server server =
              ServerCreator.createServer(project, rootFolder, cordovaEngineLocation, port);
          server.start();

          Connector connector = server.getConnectors()[0];
          port =
              connector
                  .getLocalPort(); // for the case if port equals 0 is requested (any free port)

          ServerStorage.getStorage().put(port, server); // Adding server to the ServerStorage

          parameters.add(rootFolder.getRawLocation().makeAbsolute().toString());
          parameters.add(
              "http://localhost:"
                  + port
                  + "/"
                  + actualStartPageString); //$NON-NLS-1$ //$NON-NLS-2$

          if (cordovaVersion != null) {
            parameters.add("-version"); // $NON-NLS-1$
            parameters.add(cordovaVersion);
          }
          if (proxy != null) {
            parameters.add("-proxy"); // $NON-NLS-1$
            parameters.add(proxy);
          }
          launchCordovaSim(parameters);
        } else {
          showPortInUseMessage(port);
        }
      } catch (Exception e) {
        Activator.logError(e.getMessage(), e);
      }
    } else {
      Display.getDefault()
          .asyncExec(
              new Runnable() {
                @Override
                public void run() {
                  Shell parentShell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
                  if (parentShell == null) {
                    parentShell =
                        PlatformUI.getWorkbench().getDisplay().getShells()[0]; // Hot fix for gtk3
                  }
                  MessageDialog.openError(
                      parentShell,
                      Messages.CordovaSimLauncher_CANNOT_RUN_CORDOVASIM,
                      Messages.CordovaSimLauncher_CANNOT_FIND_ROOT_FOLDER);
                }
              });
    }
  }