Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default VM arguments in Eclipse debug configuration?

Tags:

java

eclipse

When I implement new features using TDD, I often use the shortcut Shift + Alt + D T to run only the jUnit test case I am currently working on (and not the whole test suite, which takes a few minutes).

This creates a new Debug Configuration for the current Java source and runs it immediately. Now I would like to run the test with assertions enabled (VM option -ea).

Unfortunately, the VM arguments for the new debug configuration starts empty. I always have to go into Debug Configurations...Arguments and add -ea to the VM arguments input box.

Is there any way to have Eclipse these arguments populated with (project or workspace wide) default options?

like image 419
Bluehorn Avatar asked Jul 15 '09 14:07

Bluehorn


People also ask

How do I set default VM arguments in Eclipse?

-- Go to the Eclipse Window > preferences, in "Java > Installed JREs". -- Copy the current default JRE with a new name, for example myJRE. -- Select the new JRE and click on the "Edit" button. -- In the "Edit JRE" dialog, add your JVM arguments in the "Default VM Arguments" field.

How do I show a VM argument in Eclipse?

Expand the Java section and select Installed JREs. Then in the main content window, select the JRE that you are using to run your project, and click the Edit… button. A dialog will appear, with an entry field labeled Default VM arguments.

What is program arguments and VM arguments in Eclipse?

Program Argument: Program arguments are arguments that are passed to your application, which are accessible via the "args" String array parameter of your main method. VM Argument: VM arguments are environment or system argument that needed by JVM to execute the program.

What is the value of VM arguments?

VM arguments are typically values that change the behaviour of the Java Virtual Machine (JVM). For example, the -Xmx256M argument allows the Java heap to grow to 256MB. The Eclipse runtime is also configurable via many system properties which can be passed as VM arguments in the form: -DpropertyName=propertyValue.


2 Answers

I think you can set this option by editing the definition of the JRE under PreferencesJavaInstalled JREs → Select the JRE in question and edit the default VM arguments

like image 185
Grem Avatar answered Sep 29 '22 06:09

Grem


WindowsPreferencesJUnit has an option to add -ea every time a new launch configuration is created. It adds the -ea option to the Debug Configuration as well.

The full text next to a check box is:

Add -ea to VM arguments when creating a new JUnit launch configuration

like image 22
RAbraham Avatar answered Sep 29 '22 07:09

RAbraham