Tuesday, March 23, 2010

Assertions

Selective enabling and Disabling:

  • With no Arguments(as in the preceding examples) enables or disables assertions in all classes ,except for the System class.
  • With packae name: Enables or disables assertions in the package specified ,and any packages below this package in the same directory hierarchy.
  • With a class name Enables or disables assertions in the class specified.

java -ea -da:com.geeksanonymous.Foo

The preceding command tells the JVM to enable the assertions in general,but disable them in the class.geeksanonymous.Foo.You can do the same selectively for a package as follows:

java -ea -da:com.geeksanonymous...

No comments: