I want to add the -ea
option. I set it in Project Settings
--> Compiler
--> Java Compiler
: Additional command line parameters
.
But it caused a make error: invalid flag: -ea
.
P.S.: the above error message may not be the same as yours, because IntelliJ showed error in my native language, not English. I translated it into English.
The -ea
option to enable assertions is passed to the JVM not to the compiler. Add it as a VM option for your runtime configuration.
Specific location in the menu: Run > Edit Configurations... > Configuration > VM options:
You can also make IntelliJ IDEA support assertions by default by changing the default Application configuration:
In the top menu, press Run > Edit Configurations > Defaults > Application > VM options.
To enable the assertion feature for all application, you could just fill the VM options
with -ea