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