步骤:
- Window->Preferences->Java->Installed JREs->Edit
-
Edit JRE->Default VM arguments->输入 -ea
(ea:enable assertions)
Eclipse: enable assertions
To globally set it as the default for everything:
- 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.
- Go to Preferences.
- Choose Java, and then Installed JREs from the left panel.
- Select your JRE, and then click the Edit... button in the right panel.
- In the Default VM arguments field, add -ea.