Skip to content

Quick Start

This walks through analyzing a JVM project end to end. It assumes codelens is installed and a JDK 21+ is available.

1. Build the target project

codelens analyzes compiled bytecode, so build the project first:

cd ~/work/my-service
./gradlew build -x test   # or: ./gradlew classes testClasses

See Target Project Setup for the full prerequisites.

2. Run a command

The server auto-starts on the first command. Most commands take the project from the current directory; use -p/--project to point elsewhere.

codelens classes list --package "com.example.*"

The first invocation starts the background server (this includes the initial bytecode scan, which can take a few seconds to a minute on large projects). Subsequent commands reuse it.

3. Explore the codebase

# Classes
codelens classes show com.example.UserService
codelens classes implementations com.example.Repository
codelens classes hierarchy com.example.UserService
codelens classes dependencies com.example.UserService

# Methods and annotations
codelens methods search --name "find*"
codelens annotations usages javax.inject.Singleton

# Source — your code, library code, or the JDK
codelens source show com.example.UserService
codelens source show java.util.HashMap
codelens source show com.google.common.collect.ImmutableList --stub

See the CLI Reference for every command and flag.

4. Output: tables for humans, JSON for tools

In a terminal, every command prints a readable table. When output is piped or redirected — or when you pass --json — you get the full JSON payload instead:

codelens classes list                          # table (in a terminal)
codelens classes list --json | jq '.classes[].fqn'

Scripts and agents should pass --json explicitly. See Output formats.

5. Manage the server

codelens status            # status for the current project
codelens list              # all running servers
codelens refresh           # rescan after recompiling
codelens stop              # stop the server

You can run servers for multiple projects at once; each is keyed by project path and gets its own port. The server also shuts down on its own after an idle timeout (default 30m).

Next steps