"Doyle" <my*******@yahoo.com> wrote in message
news:73**************************@posting.google.c om...
| "Eric" <er************@verizon.net> wrote in message
news:<UB*****************@nwrdny03.gnilink.net>...
| > I would like to use the assert keyword, but my compiler doesn't seem to
| > recognize it. It's also not in the api (only the AssertionError is).
| >
| > What am I missing? I'm using 1.4.1_05 on windows.
| >
| > Thanks
|
| From Sun's documentation
| (
http://java.sun.com/j2se/1.4.1/docs/...ml#compiling):
|
| "Compiling Files That Use Assertions
| In order for the javac compiler to accept code containing assertions,
| you must use the -source 1.4 command-line option as in this example:
|
| javac -source 1.4 MyClass.java
| This flag is necessary so as not to cause source compatibility
| problems. "
|
| mypetrock
You also need to enable assertions when you start up the JVM with the -ea
flag
'java -ea MyClass'
--
-P