private SimpleJavaParameters createJavaParameters() throws ExecutionException {

        final SimpleJavaParameters params = new SimpleJavaParameters();
        params.setJdk(new SimpleJavaSdkType().createJdk("tmp", SystemProperties.getJavaHome()));

        File myWorkingDirectory = new File(configuration);
        params.setWorkingDirectory(myWorkingDirectory.isDirectory() ? myWorkingDirectory.getPath() : PathManager.getBinPath());

        // IDE jars.
        Collection<String> classPath = new LinkedHashSet<>(ClassPathUtil.getUtilClassPath());
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(Project.class)); //intellij.platform.core
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(PlaceHolder.class)); //intellij.platform.editor
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(DependencyScope.class)); //intellij.platform.projectModel
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ProjectExtension.class)); //intellij.platform.projectModel.impl
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(Alarm.class)); //intellij.platform.ide
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ExtensionPointName.class)); //intellij.platform.extensions
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(StorageUtilKt.class)); //intellij.platform.ide.impl
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ExternalSystemTaskNotificationListener.class)); //intellij.platform.externalSystem
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(AtomicFieldUpdater.class)); //intellij.platform.concurrency

        // java plugin jar if it's installed
        Class<? extends SdkType> javaSdkClass = ExternalSystemJdkProvider.getInstance().getJavaSdkType().getClass();
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(javaSdkClass));

        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ModuleType.class));
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(EmptyModuleType.class));

        // add Kotlin runtime
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(Unit.class));
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(NoSuchPropertyException.class));

        // External system module jars
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(getClass()));
        // external-system-rt.jar
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ExternalSystemException.class));
        // com.intellij.openapi.externalSystem.model.FSTSerializer dependencies
        ContainerUtil.addIfNotNull(classPath, getJarPathForClass(ObjectSerializer.class));

        params.getClassPath().addAll(new ArrayList<>(classPath));

        params.setMainClass(MAIN_CLASS_NAME);
        params.getVMParametersList().addParametersString("-Djava.awt.headless=true");

        // It may take a while for external system api to resolve external dependencies. Default RMI timeout
        // is 15 seconds (http://download.oracle.com/javase/6/docs/technotes/guides/rmi/sunrmiproperties.html#connectionTimeout),
        // we don't want to get EOFException because of that.
        params.getVMParametersList().addParametersString(
          "-Dsun.rmi.transport.connectionTimeout=" + TimeUnit.HOURS.toMillis(1)
        );
        // Context propagation depends on kotlinx.coroutines library.
        // We don't want to pass it for context propagation only, so until there is a significant reason to do it,
        // we would rather disable context propagation completely within the spawned process
        params.getVMParametersList().addParametersString(
          "-Dide.propagate.context=false"
        );
        final String debugPort = System.getProperty(ExternalSystemConstants.EXTERNAL_SYSTEM_REMOTE_COMMUNICATION_MANAGER_DEBUG_PORT);
        if (debugPort != null) {
          params.getVMParametersList().addParametersString("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + debugPort);
        }

        ProjectSystemId externalSystemId = myTargetExternalSystemId.get();
        if (externalSystemId != null) {
          ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
          if (manager != null) {
            params.getClassPath().add(getJarPathForClass(manager.getProjectResolverClass()));
            params.getClassPath().add(getJarPathForClass(manager.getClass().getSuperclass()));
            params.getProgramParametersList().add(manager.getProjectResolverClass().getName());
            params.getProgramParametersList().add(manager.getTaskManagerClass().getName());
            manager.enhanceRemoteProcessing(params);
          }
        }

        return params;
      }
private SimpleJavaParameters createJavaParameters()