在 IntelliJ IDEA 中在哪里添加编译器选项,如 -ea? [英] Where to add compiler options like -ea in IntelliJ IDEA?
问题描述
我想添加 -ea
选项.我在 Project Settings
--> Compiler
--> Java Compiler
: Additional command line parameters
中设置它.
I want to add the -ea
option. I set it in Project Settings
--> Compiler
--> Java Compiler
: Additional command line parameters
.
但它导致了一个 make 错误:invalid flag: -ea
.P.S.:上面的错误信息可能和你的不一样,因为 IntelliJ 用我的母语而不是英语显示错误.我把它翻译成英文.
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.
推荐答案
用于启用断言的 -ea
选项会传递给 JVM,而不是传递给编译器.将其添加为运行时配置的 VM 选项.
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.
菜单中的特定位置:运行 > 编辑配置... > 配置 > 虚拟机选项:
这篇关于在 IntelliJ IDEA 中在哪里添加编译器选项,如 -ea?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!