Search code examples
javaintellij-ideajava-9java-10

Intellij IDEA: Pass java command arguments


I need to pass arguments after java but before class name at application startup in IDEA.

In "edit configuration" section "program arguments" adds options after class name.

I need this because of some features like --add-modules for java 9+. For example I want to make IDEA runs this*:

java --add-modules java.xml.ws com.pany.MainKt

But for now it does this:

java com.pany.MainKt --add-modules java.xml.ws

*All other arguments generated by IDEA are omitted for brevity.


Solution

  • JVM arguments must be added to the "VM options" field:

    java <some intellij stuff> <VM options> <Main class> <Program arguments>