API Usage Examples

To get familiar with the API these examples demonstrate different aspects of the JaCoCo API. Each example can be separately compiled and executed as a Java main program. Some examples require additional command line arguments.

To compile and run these example you need ASM ${asm.version} in addition to the JaCoCo libraries.

File Description
CoreTutorial.java This tutorial-like example instruments, executes and analyzes a single target class. Finally line coverage information is printed to the console.
ClassInfo.java This example writes JaCoCo specific information for given Java class files.
ExecDump.java Utility to dump the content of execution data files in readable form.
MBeanClient.java This example connects to a coverage agent to collect execution data over the JMX.
ExecutionDataClient.java This example connects to a coverage agent to collect execution data over the remote protocol.
ExecutionDataServer.java This example starts a socket server to collect execution data from agents over the remote protocol.
ReportGenerator.java This example generates HTML reports based on a simple project layout and well known execution data store file name.