How to get java command-line


In my pugin i'm trying to get java command line that starts application from the current run configuration.
I use this code:

public static JavaParameters getJavaParameters( final DataContext dataContext
, final RunConfiguration runcfg )
return ApplicationManager.getApplication().runReadAction(new Computable]]>() {
public JavaParameters compute() {
JavaProgramRunner runner = ExecutionRegistry.getInstance().getDefaultRunner();
JavaParameters javaParameters;
try {
JavaCommandLineState state = (JavaCommandLineState) runcfg.getState( dataContext
, runner.getInfo()
, null, null );
javaParameters = state.getJavaParameters();
} catch (ExecutionException exeption) {
// exeption.printStackTrace();
javaParameters = null;
return javaParameters;

but i get the following exception:
at com.intellij.execution.application.ApplicationConfiguration$MyJavaCommandLineState.createJavaParameters(
at com.intellij.execution.configurations.JavaCommandLineState.getJavaParameters(
at com.excelsior.jetplugin.idea.JetPluginUtils$1.compute(
at com.excelsior.jetplugin.idea.JetPluginUtils$1.compute(
at com.intellij.openapi.application.impl.ApplicationImpl$
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(
at com.excelsior.jetplugin.idea.JetPluginUtils.getJavaParameters(
at com.excelsior.jetplugin.idea.actions.JetActionManager.createJetControlPanelProject(

can anybody advice me?


Did you find the issue already? (have the same problem)


now we use

runcfg.getState( dataContext, runner.getInfo()
, new RunnerSettings]]>(null, null)
, null );

instead of

runcfg.getState( dataContext
, runner.getInfo()
, null, null );

to get JavaCommandLineState object.

in OpenAPI for IDEA 6 RunnerSettings object wasn't used in getJavaParameters() method, but for IDEA 7 this method uses RunnerSettings. And i don't find any examples how should i get this object.

this workaround works fine in my case


Please sign in to leave a comment.