com.intellij.execution.configurations.SimpleJavaParameters Java Examples

The following examples show how to use com.intellij.execution.configurations.SimpleJavaParameters. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 6 votes vote down vote up
private void configureConfiguration(SimpleJavaParameters parameters, XQueryRunConfiguration configuration) {
    ProgramParametersUtil.configureConfiguration(parameters, configuration);

    Project project = configuration.getProject();
    Module module = getModule(configuration);
    ;

    String alternativeJrePath = configuration.getAlternativeJrePath();
    if (alternativeJrePath != null) {
        configuration.setAlternativeJrePath(expandPath(alternativeJrePath, null, project));
    }

    String vmParameters = configuration.getVMParameters();
    if (vmParameters != null) {
        vmParameters = expandPath(vmParameters, module, project);

        for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
            vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false);
        }
    }

    parameters.getVMParametersList().addParametersString(vmParameters);
}
 
Example #2
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private void configureModule(final RunConfigurationModule runConfigurationModule,
                             final SimpleJavaParameters parameters,
                             @Nullable String jreHome) throws CantRunException {
    Module module = runConfigurationModule.getModule();
    if (module == null) {
        throw CantRunException.noModuleConfigured(runConfigurationModule.getModuleName());
    }
    configureByModule(parameters, module, createModuleJdk(module, jreHome));
}
 
Example #3
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private void configureByModule(SimpleJavaParameters parameters, final Module module, final Sdk jdk) throws CantRunException {
    if (jdk == null) {
        throw CantRunException.noJdkConfigured();
    }
    parameters.setJdk(jdk);
    setDefaultCharset(parameters, module.getProject());
    configureEnumerator(OrderEnumerator.orderEntries(module).runtimeOnly().recursively(), jdk).collectPaths(parameters.getClassPath());
}
 
Example #4
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private SimpleJavaParameters prepareRunnerParameters() throws CantRunException {
    final SimpleJavaParameters parameters = new SimpleJavaParameters();
    parameters.setMainClass(configuration.getRunClass());
    boolean isDebugging = getEnvironment().getExecutor().getId().equals(DefaultDebugExecutor.EXECUTOR_ID);
    parameters.getProgramParametersList().prepend(getSerializedConfig(configuration, isDebugging, port).getAbsolutePath());
    parameters.getClassPath().addFirst(new XQueryRunnerClasspathEntryGenerator().generateRunnerClasspathEntries(configuration));
    return parameters;
}
 
Example #5
Source File: JdkUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void appendParamsEncodingClasspath(SimpleJavaParameters javaParameters,
                                                  GeneralCommandLine commandLine,
                                                  ParametersList parametersList) {
  commandLine.addParameters(parametersList.getList());
  appendEncoding(javaParameters, commandLine, parametersList);
  if (!parametersList.hasParameter("-classpath") && !parametersList.hasParameter("-cp")){
    commandLine.addParameter("-classpath");
    commandLine.addParameter(javaParameters.getClassPath().getPathsString());
  }
}
 
Example #6
Source File: RemoteCommandLineBuilder.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 4 votes vote down vote up
public static GeneralCommandLine createFromJavaParameters(final SimpleJavaParameters javaParameters,
                                                          final Project project,
                                                          final boolean dynamicClasspath) throws CantRunException {
    return createFromJavaParameters(javaParameters, dynamicClasspath && JdkUtil.useDynamicClasspath(project));
}
 
Example #7
Source File: PantsManager.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) {
  parameters.getVMParametersList().addProperty(
    ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, PantsConstants.SYSTEM_ID.getId()
  );
}
 
Example #8
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private SimpleJavaParameters getJavaParameters() throws ExecutionException {
    if (myParams == null) {
        myParams = createJavaParameters();
    }
    return myParams;
}
 
Example #9
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private SimpleJavaParameters createJavaParameters() throws ExecutionException {
    final SimpleJavaParameters parameters = prepareRunnerParameters();
    configureJreRelatedParameters(parameters);
    return parameters;
}
 
Example #10
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private void configureJreRelatedParameters(SimpleJavaParameters parameters) throws CantRunException {
    final RunConfigurationModule module = configuration.getConfigurationModule();
    final String jreHome = configuration.isAlternativeJrePathEnabled() ? configuration.getAlternativeJrePath() : null;
    configureModule(module, parameters, jreHome);
    configureConfiguration(parameters, configuration);
}
 
Example #11
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private void setDefaultCharset(SimpleJavaParameters parameters, final Project project) {
    Charset encoding = EncodingProjectManager.getInstance(project).getDefaultCharset();
    parameters.setCharset(encoding);
}
 
Example #12
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private GeneralCommandLine createFromJavaParameters(final SimpleJavaParameters javaParameters,
                                                    final Project project) throws CantRunException {
    return createFromJavaParameters(javaParameters, JdkUtil.useDynamicClasspath(project));
}
 
Example #13
Source File: ParametersEnhancer.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Our recommended practice is to work with third-party api from external process in order to avoid potential problems with
 * the whole ide process. For example, the api might contain a memory leak which crashed the whole process etc.
 * <p/>
 * This method is a callback which allows particular external system integration to adjust that external process
 * settings. Most of the time that means classpath adjusting.
 *
 * @param parameters  parameters to be applied to the slave process which will be used for external system communication
 */
void enhanceRemoteProcessing(@Nonnull SimpleJavaParameters parameters) throws ExecutionException;