java 如何在 IDEA 中定义默认的 JVM 参数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32484449/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to define default JVM arguments in IDEA?
提问by Philipp Cla?en
Is there an option to define default JVM arguments in IntelliJ IDEA?
是否可以选择在 IntelliJ IDEA 中定义默认 JVM 参数?
For example, I would like to always activate:
例如,我想始终激活:
-ea -Dslf4j.detectLoggerNameMismatch=true
-ea -Dslf4j.detectLoggerNameMismatch=true
In Eclipse, the option can be found in:
在 Eclipse 中,可以在以下位置找到该选项:
- Preferences -> Java -> Installed JREs -> Edit -> Default VM arguments
- 首选项 -> Java -> 已安装的 JRE -> 编辑 -> 默认 VM 参数
回答by yshavit
You have to do it per run type (Application, JUnit test, etc).
您必须按运行类型(应用程序、JUnit 测试等)执行此操作。
In the "edit configurations" window ("Run" ? "Edit Configurations..."), expand the "Defaults" item, select the appropriate run type, and edit its defaults in the left pane.
在“编辑配置”窗口(“运行”?“编辑配置...”)中,展开“默认值”项,选择适当的运行类型,并在左窗格中编辑其默认值。
The full documentation is available in the IDEA docs.
回答by OneWorld
回答by Alz
You can set your VM options for all applications as a default by picking the application type (for command line Java programs it would be 'Application') under the 'Templates' tree found via the menu items Run/Edit Configurations... Then all new applications you create will use that default. Older versions of IntelliJ IDEA labeled that tree 'Defaults'.
您可以将所有应用程序的 VM 选项设置为默认值,方法是在“模板”树下通过菜单项“运行/编辑配置...您创建的新应用程序将使用该默认值。旧版本的 IntelliJ IDEA 将该树标记为“默认值”。