Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: enable assertions

I'm running Eclipse Galileo. How do I enable assertions in Eclipse?

As suggested by other sites, I've tried adding the arguments: -ea. I have also tried changing the compiler compliance level to 1.4. Neither of those suggestions worked.

like image 916
well actually Avatar asked Apr 01 '11 04:04

well actually


1 Answers

  1. Go to the menu Run, and then to the menu item Run Configurations.

enter image description here

  1. In the left panel, go to Java Application, and then go to Assertions.

  2. In the right panel, choose the tab Arguments.

  3. Under the field for VM arguments, type -ea to enable assertions.

enter image description here

  1. Click on the Apply and then Run button.

To globally set it as the default for everything:

  1. Go to menu Window (if you are on Windows), or go to menu Eclipse (if you are on Mac). For Linux it might be something similar.

  2. Go to Preferences.

  3. Choose Java, and then Installed JREs from the left panel.

  4. Select your JRE, and then click the Edit... button in the right panel.

  5. In the Default VM arguments field, add -ea.

like image 126
sreeprasad Avatar answered Sep 28 '22 03:09

sreeprasad