How to Use Claude Code in IntelliJ IDEA 2026

Written by Michael Lip · Solo founder of Zovo · $400K+ on Upwork · 100% JSS Join 50+ builders · More at zovo.one

The Workflow

Configure Claude Code to work seamlessly inside IntelliJ IDEA’s built-in terminal for Java and Kotlin development. You will have AI-assisted coding directly in your JetBrains IDE without leaving the editor.

Expected time: 10 minutes setup, immediate productivity gains Prerequisites: IntelliJ IDEA 2024.3+, Claude Code CLI installed, Node.js 18+

Setup

1. Install Claude Code CLI

npm install -g @anthropic-ai/claude-code
claude --version

Confirms Claude Code is available system-wide for IntelliJ’s terminal to access.

2. Configure IntelliJ Terminal Shell

Open IntelliJ IDEA settings and point the terminal to your preferred shell with Claude Code in its PATH.

Settings → Tools → Terminal → Shell path:
/bin/zsh  (macOS/Linux)
C:\Program Files\Git\bin\bash.exe  (Windows)

Environment variables:
ANTHROPIC_API_KEY=sk-ant-xxxxx

Set the API key in IntelliJ’s terminal environment so Claude Code authenticates without extra configuration.

3. Create a CLAUDE.md for Your Java Project

# Project Context

Java 21 project using Spring Boot 3.3 and Gradle 8.5.
Package structure: com.example.myapp
Test framework: JUnit 5 with Mockito
Code style: Google Java Format

## Conventions
- Use record types for DTOs
- Constructor injection only (no @Autowired on fields)
- All public methods must have Javadoc
- Integration tests use @SpringBootTest with TestContainers

Place this file at your project root so Claude Code understands your codebase conventions.

4. Set Up External Tool for Quick Access

Settings → Tools → External Tools → Add:
  Name: Claude Code
  Program: claude
  Arguments: (leave empty for interactive)
  Working directory: $ProjectFileDir$

This lets you launch Claude Code from the Tools menu or assign a keyboard shortcut.

5. Assign a Keybinding

Settings → Keymap → search "Claude Code" (External Tools):
  Assign: Ctrl+Shift+C (or Cmd+Shift+C on macOS)

6. Verify

cd /path/to/your/java-project
claude --print "List the source files in src/main/java"
# Expected output:
# Lists your Java source files from the project directory

Usage Example

Here is a complete workflow for generating a Spring Boot REST controller with Claude Code inside IntelliJ’s terminal:

# Open IntelliJ terminal (Alt+F12) and start Claude Code
claude

# Ask Claude to generate a new endpoint
> Create a REST controller for managing User entities with CRUD operations.
> Use Spring Boot 3.3 conventions, ResponseEntity returns, and add
> validation annotations on the request DTO.

Claude Code generates the controller:

package com.example.myapp.controller;

import com.example.myapp.dto.CreateUserRequest;
import com.example.myapp.dto.UserResponse;
import com.example.myapp.service.UserService;
import jakarta.validation.Valid;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.UUID;

@RestController
@RequestMapping("/api/v1/users")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }

    @PostMapping
    public ResponseEntity<UserResponse> createUser(
            @Valid @RequestBody CreateUserRequest request) {
        UserResponse created = userService.create(request);
        return ResponseEntity.status(HttpStatus.CREATED).body(created);
    }

    @GetMapping("/{id}")
    public ResponseEntity<UserResponse> getUser(@PathVariable UUID id) {
        return ResponseEntity.ok(userService.findById(id));
    }

    @GetMapping
    public ResponseEntity<List<UserResponse>> listUsers(
            @RequestParam(defaultValue = "0") int page,
            @RequestParam(defaultValue = "20") int size) {
        return ResponseEntity.ok(userService.findAll(page, size));
    }

    @PutMapping("/{id}")
    public ResponseEntity<UserResponse> updateUser(
            @PathVariable UUID id,
            @Valid @RequestBody CreateUserRequest request) {
        return ResponseEntity.ok(userService.update(id, request));
    }

    @DeleteMapping("/{id}")
    public ResponseEntity<Void> deleteUser(@PathVariable UUID id) {
        userService.delete(id);
        return ResponseEntity.noContent().build();
    }
}

Then generate the corresponding test:

> Now generate a JUnit 5 test for this controller using MockMvc and Mockito
@WebMvcTest(UserController.class)
class UserControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private UserService userService;

    @Autowired
    private ObjectMapper objectMapper;

    @Test
    void createUser_returnsCreated() throws Exception {
        CreateUserRequest request = new CreateUserRequest("John", "[email protected]");
        UserResponse response = new UserResponse(UUID.randomUUID(), "John", "[email protected]");
        when(userService.create(any())).thenReturn(response);

        mockMvc.perform(post("/api/v1/users")
                .contentType(MediaType.APPLICATION_JSON)
                .content(objectMapper.writeValueAsString(request)))
                .andExpect(status().isCreated())
                .andExpect(jsonPath("$.name").value("John"));
    }
}

Common Issues

Why This Matters

Java developers using IntelliJ spend 60-70% of their time in the IDE. Having Claude Code accessible via a keybinding eliminates context switching and keeps code generation within your existing workflow.