Enabling assertions in Eclipse

Posted on Wednesday, June 24, 2009


For the entire project

  1. Go to menu Window > Preferences
  2. In the dialogue that appears, select Installed JREs
  3. Select your JRE, and click Edit. A new dialog opens.
  4. Enter -ea under Default VM Arguments
  5. Click Ok to save the change.

For a particular program execution

  1. Open the Run Dialog (this should be an option under the “Run” menu).
  2. Click on the tab, “(x)= Arguments.”
  3. In the field for “VM arguments,” enter -ea to enable assertions.
  4. Click on the “Apply” button.
Posted in: Java