Running
As mentioned previously, the -javaagent switch that was added to Java 1.5 is used to dynamically insert contract verification to your classes.
Running a C4J enabled application from the command line looks as below, provided that your classpath contains the javassist.jar jar and your test classes
(don't forget to enable assertions using the -ea switch):
java -javaagent:../dist/c4j.jar -ea simple.Test
Arguments are passed to the -javaagent switch as a comma separated string after the agent jar. There are a couple of command line switches that C4J honors:
loglevel=<debug|info|warn> - will print more information on classes being instrumented. Default to only print errors.
trace=<true|false> - will print details about contracts that are verified during runtime. Defaults to false.
exit-on-unknown-contract=<true|false> - will make C4J abort the JVM or not if a contract inconsistency is found. Defaults to true.
excludes=<perl-like regexp> - will exclude matching contracts.
includes=<perl-like regexp> - will override excludes.
classfiledir=<dir> - makes the instrumented classes to be written to the specified directory.
-javaagent:../dist/c4j.jar=trace=true,excludes=my.test.Contract