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.

  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

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
analysis = CLDK(language="java").analysis(project_path="commons-cli")
print(len(analysis.get_classes()), "classes")

To point the SDK at a JAR you built yourself, pass analysis_backend_path. See Python SDK integration.

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.