Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to enable assertions in Eclipse

 
John G Wright
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all !

I compile and run using Ctrl + F11. But in case of assertions, how to enable assertions at run time in Eclipse ? I can get the output for enabling assertions at command prompt. How to do the same in eclipse ?

Thanks
 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in case of eclipse you have to right click your project or file and then select Run as > Run configurations. in the opened menu , select Arguments tab. then there will be option VM ARGUMENT. there you have to supply the switch for enabling the assertions. you can do -ea and check it out. hope this helps
 
John G Wright
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply and it helped a lot. I was trying the same in program arguments and that's the reason I was not getting any assertion errors.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic