In my project configuration in IDEA, I have the following text fields:
I woul
$ENV_VAR$ will be resolved correctly.
Idea uses its own notation for environment variables, they should be denoted with two dollar signs on both sides.
You can access environment variables using the brace-enclosed environment variable syntax. Example:
VM options: -Dfoo=${MY_ENV_VAR}
MY_ENV_VAR
environment variable will be expanded properly.
Update: tested in IntelliJ IDEA 2017.1.2 and still working.
Environment variables are not the same thing as program arguments. If you want to pass program arguments then you would call
java MyMainClass /some/random/path 2
Then args[] would contain
0: /some/random/path
1: 2