When using the JDK 1.4+ assert keyword, it’s nice in Eclipse to enable them for all your launch configurations at once. The easiest way to do this is to specify a default VM argument for your installed JDK. You can do this by going to Windows -> Preferences -> Java -> Installed JREs
. Then select your JDK and click the Edit… button. In the “Default VM Arguments” box, add -ea
.
That’s it! Now you’re assertion enabled for all java launch configurations (Run as JUnit, Run as Java App, etc). This is also a useful technique if you’ve got some testing infrastructure that needs special system properties to customize the launch configs to your local environment – just add your -D parameters in the same box.