Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to add compiler options like -ea in IntelliJ IDEA?

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.

like image 226
duleshi Avatar asked Aug 11 '13 02:08

duleshi


People also ask

How do I add compiler arguments in IntelliJ?

A solution is to add "-parameters" in the IntelliJ settings: "Settings" > "Build, Execution, Deployment" > "Compiler" > "Java Compiler" > add "-parameters" as "Additional command line parameters".

Does IntelliJ have compiler?

IntelliJ IDEA uses a compiler that works according to the Java specification. You can compile a single file, use the incremental build for a module or a project, and rebuild a project from scratch.

What compiler does IntelliJ use?

IntelliJ IDEA comes bundled with the Eclipse compiler. Groovy-Eclipse.

Where is Configure option in IntelliJ?

To configure project settings, select IntelliJ IDEA | Preferences on macOS or File | Settings on Windows and Linux from the main menu. Alternatively, you can press Ctrl+Alt+S to show the IDE settings.


2 Answers

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:

Where to put the <code>-ea</code> flag

like image 143
Dev Avatar answered Sep 27 '22 02:09

Dev


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

like image 24
neo Avatar answered Sep 23 '22 02:09

neo