Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define default JVM arguments in IDEA?

Is there an option to define default JVM arguments in IntelliJ IDEA?

For example, I would like to always activate:

  • -ea -Dslf4j.detectLoggerNameMismatch=true

In Eclipse, the option can be found in:

  • Preferences -> Java -> Installed JREs -> Edit -> Default VM arguments
like image 785
Philipp Claßen Avatar asked Sep 09 '15 16:09

Philipp Claßen


People also ask

How do I change the default JVM argument?

Yes, right click the project. Click Run as then Run Configurations . You can change the parameters passed to the JVM in the Arguments tab in the VM Arguments box. That configuration can then be used as the default when running the project.


2 Answers

You have to do it per run type (Application, JUnit test, etc).

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.

like image 191
yshavit Avatar answered Oct 08 '22 07:10

yshavit


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'.

like image 3
Alz Avatar answered Oct 08 '22 06:10

Alz