Skip to content

Quickstart

Get up and running with LeanJ in just a few steps. This guide assumes you’ve already installed LeanJ.

Prerequisites

Make sure you have everything ready before starting.

CLI Installed

LeanJ CLI must be in your PATH

Java JDK 11+

Required for profiling Java applications

IntelliJ IDEA 2023.1+

Optional, for IDE integration and inline hints


Start the controller daemon that manages agent connections and provides the API:

Terminal window
leanj controller start

The controller runs on:

  • TCP port 9876 (for agent connections)
  • HTTP port 9877 (for CLI/IDE API)

Expected Output

Controller started successfully
TCP Port: 9876
HTTP Port: 9877

List all running Java applications that can be profiled:

Terminal window
leanj jvms

Example Output

Found 2 JVM(s):
1. com.example.SampleLoop
ID: abc123
PID: 12345
Environment: local
2. order-service
ID: def456
Environment: docker
App: order-service

Attach the profiler to your Java application. You can use either the PID or JVM ID:

Using PID:

Terminal window
leanj attach --pid 12345

Using JVM ID:

Terminal window
leanj attach --jvm-id abc123

Success Message

Agent attached successfully to JVM abc123

If you’re using IntelliJ IDEA, you can start profiling directly from the IDE:

  1. Open IntelliJ IDEA
  2. Go to Run → Start LeanJ Profiling

The plugin will automatically:

  • ✅ Call the CLI
  • ✅ Start the controller (if not running)
  • ✅ Discover JVMs
  • ✅ Attach the agent

💡 Tip

The IntelliJ plugin handles all the CLI operations for you. No need to run commands manually!


Once profiling is active, you’ll see metrics directly in your code editor as inline hints:

╰─ Estimated avg execution time: 2.1ms
╰─ Max time last run: 4.8ms
╰─ Allocations per call: ~12KB
╰─ Call count: 150
╰─ Trend: +15%
public void processPayments() {
// your code here
}

You can also open the Profiler tool window at the bottom of IntelliJ to see detailed metrics and statistics.

Inline Hints

See performance metrics directly above each method in your code editor

Tool Window

Open the Profiler tool window for detailed statistics and trends


Verify everything is working correctly:

Terminal window
# Check controller and agent status
leanj status
# Run system health check
leanj doctor

System Health

The doctor command checks your system setup, verifies dependencies, and provides troubleshooting information.


Next Steps

Continue your journey with LeanJ.

IntelliJ Integration

Learn how to use LeanJ with IntelliJ IDEA for the best experience.

IntelliJ Guide

Docker Profiling

Set up profiling for Java applications running in Docker containers.

Docker Guide

CLI Commands

Explore all available CLI commands and their options.

CLI Reference

Configuration

Configure advanced settings and customize profiling behavior.

Configuration Guide

If you encounter issues, follow these steps:

  1. Run system diagnostics:

    Terminal window
    leanj doctor
  2. Check controller logs:

    Terminal window
    tail -f logs/profiler-controller.log
  3. Verify controller status:

    Terminal window
    leanj status
  4. See the Troubleshooting Guide: Visit /troubleshooting/ for common issues and solutions.

Need Help?

If you’re still having issues, check the Troubleshooting Guide or open an issue on GitHub.


LeanJ uses a CLI-centric architecture:

CLI (Go) → Controller (Java) → Agent (Java) → Java App
IntelliJ Plugin (UI)

CLI

Heart of the system - handles JVM discovery, attach/detach, controller lifecycle

Controller

Local daemon - receives data from agents, provides API to IDE/CLI

IDE Plugin

Optional UI layer - calls CLI and displays results

Agent

Works everywhere - local, Docker, Kubernetes

Learn more about how it works.