1

It is possible to enable assertions with JRE command line switch or by system call. It is relatively easy, but until you run multiple test classes by right click. This case Eclipse creates new runtime configuration for running class and it is not containing -ea.

Is it possible to enable assertion automaticly in debug runs and disable in normal runs?

UPDATE

I want to emphasize, that I probably know, how to enable assertions in single run configuration. Also I know, how to enable them globally.

But I need different: I need to do it HALF globally. I.e. enable assertions in ALL future debug configurations, and disable assertions in ALL future run configurations.

Is it possible?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • You can edit the runtime configuration and add parameters there. – Luiggi Mendoza May 20 '14 at 15:31
  • It's [possible for JUnit tests](http://stackoverflow.com/a/13457655/34088), but I don't think you can do the same for debug launch configs. – Aaron Digulla May 20 '14 at 15:35
  • @LuiggiMendoza I want to automate; see no need to do this by hands if assertions are probably should always be on on debug – Suzan Cioc May 20 '14 at 15:38
  • Edit the debug configuration to add the -ea, but do not add it in your *normal* execution. – Luiggi Mendoza May 20 '14 at 15:38
  • After your update, your problem is clearer. – Luiggi Mendoza May 20 '14 at 16:14
  • any news on this? I cant find a single way to do that from within eclipse... but if you are on linux, I think it is possible to create a `java` wrapper script that will verify the parameters on the command line and if there is debug enabling parameters, the `-ea` would be automagically added. Would that be acceptable for you? :) – Aquarius Power Apr 29 '17 at 01:06

0 Answers0