wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes How to enable Assertions in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to enable Assertions in eclipse" Watch "How to enable Assertions in eclipse" New topic
Author

How to enable Assertions in eclipse

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi All,

I want to use assertions to test my assumptions. But I wanna do that using Eclipse IDE. is there a way I can eanble assertions in eclipse?/

Thanks.


Be Humble... Be Nice.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Basically, you want to pass an argument (-ea) to the VM. How to do this might vary depending on your version of Eclipse, but here's how it works in Eclipse Europa...
  • Open the Run Dialog (this should be an option under the "Run" menu).
  • Click on the tab, "(x)= Arguments."
  • In the field for "VM arguments," enter -ea to enable assertions.
  • Click on the "Apply" button.


  • "We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
    sscce.org
    Arjun Reddy
    Ranch Hand

    Joined: Nov 10, 2007
    Posts: 627
    Yep got it. That's something new I learnt today. Thanks Marc.
    Gaurav .Singh
    Greenhorn

    Joined: Apr 06, 2010
    Posts: 8
    What about Eclipse Ganymede??
    Seetharaman Venkatasamy
    Ranch Hand

    Joined: Jan 28, 2008
    Posts: 5575

    Gaurav .Singh wrote:What about Eclipse Ganymede??


    It is common to all the versions[ganymade, galileo ... etc] of eclipse . whether i got your question or not ?
    Gaurav .Singh
    Greenhorn

    Joined: Apr 06, 2010
    Posts: 8
    yes i understood it thanls...
    Michael P Carter
    Greenhorn

    Joined: Oct 15, 2012
    Posts: 1
    You can enable assertions for Junit thus:

    Window -> Preferences -> Java -> JUnit -> check the box at the top of the dialog labelled "Add '-ea' to VM arguments".
    Campbell Ritchie
    Sheriff

    Joined: Oct 13, 2005
    Posts: 38851
        
      23
    I think this thread might fit better in the IDEs forum, so shall move it.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How to enable Assertions in eclipse