Quickstart
Install cg4j for the current user on Linux, macOS, or WSL. No sudo access is required.
Note: If
cg4jis already installed,install.shwill prompt to uninstall the current installation and then exit. Run the installer again if you want to reinstallcg4j.
Verify installation:
Usage
After installation:
# Basic usage - outputs to callgraph.csv
cg4j -j myapp.jar
# With dependencies and custom output
cg4j -j myapp.jar -o output.csv -d lib/
# Use the ASM engine
cg4j -j myapp.jar --engine asm
# Suppress info/progress logs
cg4j -j myapp.jar -q
Options
-j, --app-jar=<file>- JAR file to analyze (required)-o, --output=<file>- Output CSV file (default:callgraph.csv)-d, --deps=<dir>- Directory containing dependency JAR files--include-rt- Include Java runtime in call graph analysis (default:true)--engine- Call graph engine:walaorasm(default:wala)--exclusions- Exclusion patterns file for the ASM engine; seedefault-exclusions.txt-q, --quiet- Suppress info/progress logs (errors only)-h, --help- Show help message-v, --version- Show version information
Docker
Pull and Run
Pull the latest published image:
Show the available CLI options. The Docker container supports the same options as the local
cg4j installation shown above.
Run an analysis by mounting your current directory into the container for input and output:
docker run --rm \
-v $(pwd):/input:ro \
-v $(pwd):/output \
cg4j/cg4j:latest -j /input/myapp.jar -o /output/callgraph.csv
The /input volume mount lets the container read the application JAR and any dependency JARs
from your machine. The /output volume mount writes the generated call graph CSV back to your
machine.