Skip to content

Installation

There are three ways to get codeanalyzer-java, depending on what you’re doing.

  • A Linux, macOS, or WSL machine.
  • SDKMan! for managing JDK / GraalVM versions (recommended).

Install SDKMan! if you don’t have it:

Terminal window
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

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).

  1. Install a JDK (Java 11 or above). List available versions and install one:

    Terminal window
    sdk list java | grep sem # IBM Semeru builds
    sdk install java 17.0.10-sem
    sdk use java 17.0.10-sem
  2. Build the JAR:

    Terminal window
    git clone https://github.com/codellm-devkit/codeanalyzer-java
    cd codeanalyzer-java
    ./gradlew fatJar
  3. 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:

Terminal window
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USERNAME=neo4j
export 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 daytrader8

See the Neo4j output guide for the snapshot-vs-Bolt distinction, multi-tenancy, and the producer/consumer deployment model.

A native image needs no JVM at runtime. This is heavier to build but gives a standalone executable.

  1. Install GraalVM (17 or above):

    Terminal window
    sdk list java | grep graal
    sdk install java 21.0.2-graalce
    sdk use java 21.0.2-graalce
  2. Compile the native binary. -PbinDir is optional; without it the binary lands in build/bin:

    Terminal window
    ./gradlew nativeCompile -PbinDir=$HOME/.local/bin
  3. Run it (assuming the output dir is on your $PATH):

    Terminal window
    codeanalyzer -i /path/to/project -a 2 -o ./output

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:

Terminal window
pip install cldk
from cldk import CLDK
from 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.

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:

Terminal window
pip install "cldk[neo4j]" # or: pip install neo4j

Select 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 CLDK
from cldk.analysis import AnalysisLevel
from 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.DiGraph

Because 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.

Terminal window
java -jar build/libs/codeanalyzer-2.3.7.jar --version
# 2.3.7

If you see the version string, you’re ready — head to the Quickstart.