• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Assertion Mechanism?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Can anyone give me an example of how assertions work with respect to packages and sub packages assuming that we have a 1.4 compiler. Please help me guys.

Thanks in advance.


(corrected punctuation in topic title)
[ December 04, 2006: Message edited by: Barry Gaunt ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When using a 1.4 compiler, first, you must compile source with -source 1.4:

javac -source 1.4 <source file(s)>

Then, you use the command line switches to enable/disable assertions for all or a subset of classes/packages at runtime. For example:

java -ea:com.pkgA... -da:com.pkgA.ClassB MainClass

This says, "Run MainClass with assertions enabled in com.pkgA and all of it's subpackages, but disabled in the com.pkgA.ClassB class."

Hope that helps.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the explanation. I understood.
 
reply
    Bookmark Topic Watch Topic
  • New Topic