在 IntelliJ IDEA 中在哪里添加编译器选项,如 -ea? [英] Where to add compiler options like -ea in IntelliJ IDEA?

查看:82
本文介绍了在 IntelliJ IDEA 中在哪里添加编译器选项,如 -ea?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加 -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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆