Installation
There are three ways to get codeanalyzer-java, depending on what you’re doing.
Prerequisites
Section titled “Prerequisites”- A Linux, macOS, or WSL machine.
- SDKMan! for managing JDK / GraalVM versions (recommended).
Install SDKMan! if you don’t have it:
curl -s "https://get.sdkman.io" | bashsource "$HOME/.sdkman/bin/sdkman-init.sh"Option 1: Fat JAR (recommended)
Section titled “Option 1: Fat JAR (recommended)”The fat JAR is the standard distribution — the CLDK SDK expects a JVM, and this is the simplest path. It is also the only build that can push live to Neo4j over Bolt (see the native-image caveat below).
-
Install a JDK (Java 11 or above). List available versions and install one:
Terminal window sdk list java | grep sem # IBM Semeru buildssdk install java 17.0.10-semsdk use java 17.0.10-sem -
Build the JAR:
Terminal window git clone https://github.com/codellm-devkit/codeanalyzer-javacd codeanalyzer-java./gradlew fatJar -
Use it — the JAR lands at
build/libs/codeanalyzer-2.3.7.jar:Terminal window java -jar build/libs/codeanalyzer-2.3.7.jar -i /path/to/project -a 2 -o ./output
The fat JAR is what you run as the producer in a Neo4j deployment — a CI or Kubernetes Job that projects analysis into the graph with --emit neo4j and pushes incrementally over Bolt. Prefer the NEO4J_PASSWORD environment variable over --neo4j-password so the secret never lands in shell history or process listings:
export NEO4J_URI=bolt://localhost:7687export NEO4J_USERNAME=neo4jexport NEO4J_PASSWORD=secret # keep credentials out of argv
java -jar build/libs/codeanalyzer-2.3.7.jar \ -i /path/to/project -a 2 \ --emit neo4j \ --app-name daytrader8See the Neo4j output guide for the snapshot-vs-Bolt distinction, multi-tenancy, and the producer/consumer deployment model.
Option 2: Native binary (GraalVM)
Section titled “Option 2: Native binary (GraalVM)”A native image needs no JVM at runtime. This is heavier to build but gives a standalone executable.
-
Install GraalVM (17 or above):
Terminal window sdk list java | grep graalsdk install java 21.0.2-graalcesdk use java 21.0.2-graalce -
Compile the native binary.
-PbinDiris optional; without it the binary lands inbuild/bin:Terminal window ./gradlew nativeCompile -PbinDir=$HOME/.local/bin -
Run it (assuming the output dir is on your
$PATH):Terminal window codeanalyzer -i /path/to/project -a 2 -o ./output
Option 3: Via the Python SDK
Section titled “Option 3: Via the Python SDK”If your goal is to use Java analysis from Python, you don’t need to build anything. The CLDK SDK ships a compatible JAR and discovers it automatically:
pip install cldkfrom cldk import CLDKfrom cldk.analysis import AnalysisLevel
analysis = CLDK.java( project_path="commons-cli", analysis_level=AnalysisLevel.call_graph,)print(len(analysis.get_classes()), "classes")This is the in-process backend: the SDK runs the bundled codeanalyzer over your project, parses the resulting analysis.json, and builds the model in process. To point it at a JAR you built yourself, pass analysis_backend_path. See Python SDK integration.
Reading a Neo4j graph from Python
Section titled “Reading a Neo4j graph from Python”There’s a second SDK path that builds nothing on the read side. When analysis has already been projected into a Neo4j property graph — by a separate codeanalyzer --emit neo4j job — the SDK can become a read-only Cypher client that reconstructs the same typed model objects and the same networkx call graph as the in-process analyzer, with no JDK, no analyzer binary, and no project source required. It needs only a Bolt URI and read-only credentials.
Install the optional driver extra:
pip install "cldk[neo4j]" # or: pip install neo4jSelect this backend by passing a Neo4jConnectionConfig to the CLDK.java(...) factory. The application_name must match the --app-name the graph was loaded with — that’s how the SDK scopes every query to the right :JApplication:
from cldk import CLDKfrom cldk.analysis import AnalysisLevelfrom cldk.analysis.commons.backend_config import Neo4jConnectionConfig
analysis = CLDK.java( analysis_level=AnalysisLevel.call_graph, backend=Neo4jConnectionConfig( uri="bolt://localhost:7687", username="neo4j", password="neo4j", # read-only credentials are sufficient application_name="daytrader8", # == the CLI --app-name ),)
symbol_table = analysis.get_symbol_table() # Dict[str, JCompilationUnit]cg = analysis.get_call_graph() # networkx.DiGraphBecause the graph is external, project_path is optional for this backend — there is no source tree to point at. The Neo4j read-back expects an emitter at 2.4.0 or newer (with projection fixes landed in 2.4.1). For the full deployment story, see the Python SDK integration and the Neo4j output guide.
Verify your install
Section titled “Verify your install”java -jar build/libs/codeanalyzer-2.3.7.jar --version# 2.3.7If you see the version string, you’re ready — head to the Quickstart.