This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assert stmt in Eclipse

 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to use the assert stmt in eclipse.
assert dosomething();
The IDE does not seem to be recognizing this. How do I change my settings so that I can use this stmt?

Thanks.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to configure the complience level of the compiler in the Preferences.
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how do I do that?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which Eclipse version are you using? 3.1 has a nice filter field in the preference dialog which should make it very easy to find the settings. Do you know how to get to the preference dialog?
 
Lucky Singh
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse 3.1.
No, I don't know how to get to Preferences. When I first set up my project, I remember setting it to JDK 1.5 etc.
But I've forgotten how to do it. Can you please help me?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the "window" menu, select "preferences...". In the upcoming dialog, select java, compiler in the tree. There you should find the compliance level setting somewhere.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic