Eclipse's variables like ${project_loc}, ${resource_loc} in run configurations. Do they exist in IntelliJ?

I find much more comfortable IntelliJ than Eclipse. But there is currently a feature I really miss:

to be able to define run/debug/external tool configurations that are parametric, or context dependent.
Example in eclipse:
I write a Java program P that takes as command line argument a text file T.
I define a run configuration which passes as argument to the P the variable ${resource_loc}.
Therefore I can run the (parametric) run configuration while the input file T has my focus in eclipse's editor, to have a quick way to see the output of my program when input the file I am editing.
This means I don't have to create separate run configurations for each input file I want to run.
Any help?
Thanks for your time,

Message was edited by: lars. Find image attached

Comment actions Permalink

Hi Lars,

you may pass a system propert value as Path Variables (to vm parameters). It won't work for program parameters though as nobody ever asked to. Do you need this or did I misunderstand your question?


Comment actions Permalink

Hi Anna,
yes, I think you understood.

To clarify, looking at the picture in my previous post: The idea is that the variable ${resource_loc}'s value is resolved when the run configuration is ran; and the value corresponds to the editor I have focus in.
The information in the dialog in the picture is not very clear on this, so there's a possible use case:

I am developing a compiler and want to test with input files manually. I write the input file, whatever name it has, using an editor within the IDE

So the run configuration should resolve what is the name of the file I am editing (or formally where the focus is at the moment of the configuration being run) to input it to the compiler as a *program* (and *not* VM) parameter, and this is obtained by the use of this variable ${resource_loc} in the program arguments textbox in the run configuration.

The advantage is that only one run configuration needs to be created.

So far this is the only thing I miss from Eclipse.
Just to have a confirmation and mark the question as answered:
Is this feature available in IntelliJ?

Thanks for your time

Comment actions Permalink

Hi Lars,

I see.

It's possible to setup an external tool and pass it the {file name}/{class name} as a predefined parameter. The downside is that you would need to pass there the whole command line of your application to run. So you may start simple Application configuration, copy classpath which IDEA generates for you and pass it to your external tool.

That's not a very convenient way but it should work as a workaround I hope. IDEA doesn't have such a feature in Run Configurations so a feature request is welcome.



Please sign in to leave a comment.