• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

howto test "assert" in eclipse ?

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, good day , do anyone know how to test the assert function on eclipse IDE ?

let say i hv following code to test how assert to work



when i run the IDE , give me the error like "assert should not use for identifier" and also "the method assert(boolean) is undefined" ...anyone can guide how i test it ? thank you
 
Saloon Keeper
Posts: 28312
207
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to set the project up for J2SDK 1.4 or greater. The default is 1.3, which predates the addition of assertions.

If you select the project properties dialog, click on the "Java Compiler" topic and then select the "Compiler compliance" tab, you'll see options. You need to pick 1.4 or greater for both source and class file compatibility.

Note that this doesn't affect Ant Scripts, where you have to add the 'source="1.4"' option on the javac task or the interactive Java compiler in Eclipse will handle asserts properly (assuming you did the above) but batch compiles using your Ant file (if present) won't.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you , tim
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic