![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e104. Enabling Assertions from the Command LineThe command line options-ea and -da allow you to enable and
disable assertion in a package subtree or in a class. Here are
several examples of the switches.
Enable assertions in all non-system classes:
java -ea MyAppEnable assertions in all classes in the unnamed package: java -ea:... MyAppEnable assertions in all classes in a package subtree: java -ea:com.mycompany... MyAppEnable assertions in a particular class: java -ea:com.mycompany.MyCompany MyAppDisable assertions in all classes in a package subtree: java -da:com.mycompany... MyAppDisable assertions in a particular class: java -da:com.mycompany.MyClass MyAppMultiple assertion switches on the command line are processed from left to right. Enable assertions in all classes in a package subtree except for one class: java -ea:com.mycompany... -da:com.mycompany.MyClass MyApp
e105. Handling an Assertion Error
© 2002 Addison-Wesley. |