Article based on video by
Most developers bounce between their IDE and terminal constantly, breaking their focus every time they need AI assistance. After spending two weeks running Claude Code entirely from within IntelliJ, I stopped leaving my IDE at all. The setup isn’t obvious, and most guides skip the configuration details that actually make it work in a real Java project.
📺 Watch the Original Video
What is Claude Code and Why Integrate It with IntelliJ
If you’ve been watching developers buzz about AI-assisted coding, you’ve probably encountered Claude Code. It’s Anthropic’s command-line AI assistant that lets you chat with Claude directly from your terminal — no browser, no separate app, just a prompt waiting for you in the command line. The tradeoff is that there’s no GUI; you’re working entirely through text commands.
Understanding Claude Code as a CLI Tool
What makes Claude Code interesting is its simplicity. Once installed, you type `claude` followed by your request, and Claude responds with code, explanations, or refactoring suggestions. I’ve found that the terminal interface actually encourages more deliberate prompting — you’re forced to articulate what you want clearly before Claude can help. Sound familiar? That’s the same constraint that makes writing a good Stack Overflow question so hard.
Here’s the kicker: this integration works for any language IntelliJ supports, not just Java. Whether you’re building a Spring backend or a React frontend, Claude Code in IntelliJ adapts to whatever you’re working on. Perfect for polyglot developers who hate learning new tools for each language.
The Developer Workflow Problem It Solves
Here’s the catch with IntelliJ IDEA: it lacks built-in Claude AI integration. You could open Claude in a browser tab, copy your code over, switch back to your IDE — but that workflow breaks your concentration. Research suggests context-switching can cost up to 23 minutes to fully regain focus after a disruption. That’s not an exaggeration — it’s the reality of splitting attention between windows.
Running Claude Code from IntelliJ’s built-in terminal solves this. You stay in your IDE, keep your file tree and debugger accessible, and call on Claude whenever you need it. The CLI workaround isn’t a limitation — it’s actually elegant. You’re not sacrificing any IDE features; you’re just gaining AI assistance without leaving your workflow. For developers who live in IntelliJ, this is the practical path to AI-assisted coding.
Prerequisites: Installing Claude Code on Your Machine
Before we get Claude Code running inside IntelliJ, we need to set it up on your machine first. This part is straightforward, but it’s where most people stumble — so let’s walk through it carefully.
System Requirements
The main thing you need is Node.js installed on your system. Claude Code ships as an npm package, which means it runs through Node. If you’ve done any JavaScript or front-end work, you probably already have this. Run `node –version` in your terminal to check — if you get a version number back, you’re good. If not, grab Node from nodejs.org (the LTS version works fine).
That’s really it for dependencies. A modern operating system with Node installed will handle everything else.
Installation Methods for Different Operating Systems
Once Node is sorted, installation takes about 30 seconds. Open your terminal and run:
“`
npm install -g @anthropic-ai/claude-code
“`
The `-g` flag installs it globally, so you can call `claude` from any directory. On macOS or Linux, you might need `sudo` depending on your setup.
After installation, you need an API key. Head to console.anthropic.com and create one — it’s free to get started. Once you have it, set the `ANTHROPIC_API_KEY` environment variable in your shell config file (like `.bashrc` or `.zshrc`):
“`
export ANTHROPIC_API_KEY=’your-key-here’
“`
Then reload your config with `source ~/.zshrc` (or whatever shell you’re using) and type `claude` to verify everything works. You should see the interactive prompt. If you do — you’re ready to connect it to IntelliJ.
Configuring IntelliJ’s Terminal for Claude Code
Setting Up Your Default Shell
Before Claude Code will respond to your commands, IntelliJ needs to know which shell to use. Head to Settings → Tools → Terminal and check that the shell path field points to the right place. IntelliJ usually auto-detects your system’s default—bash on macOS/Linux, PowerShell on Windows—but it’s worth confirming. If you’re running zsh or fish, you might see those show up automatically too.
Ensuring PATH Access to Claude
Here’s where people get stuck. You installed Claude Code globally, the `claude` command works in your regular terminal, but IntelliJ’s embedded terminal can’t find it. Sound familiar? This usually happens because IntelliJ spawns its terminal with a snapshot of your environment that might be outdated. The fix is often embarrassingly simple: restart IntelliJ entirely. Yes, close it down completely and reopen it. This forces the IDE to re-read your PATH and environment variables fresh.
A Note for Windows Users
On Windows, things get a bit trickier. The default CMD shell that IntelliJ uses sometimes doesn’t inherit your full PATH, which means Claude won’t be accessible even when it’s installed correctly. I’d suggest switching to PowerShell or Windows Terminal as your shell path instead—both of these pick up your environment variables more reliably. You can change this in the same Terminal settings panel where you verified your shell path.
Testing Your Setup
Once you’ve restarted and configured your shell, open the terminal panel using View → Tool Windows → Terminal, then type `claude` and hit Enter. If you see the startup message or help output, you’re ready to go. If you get a “command not found” error, double-check your PATH in your shell’s rc file (.bashrc, .zshrc, or PowerShell profile) and restart once more.
Running Claude Code Commands from IntelliJ Terminal
Basic Interactive Sessions
Fire up the Terminal window in IntelliJ (Alt+F12 on Windows, or the Terminal tool window) and type `claude` to drop into interactive mode. You’re now in a conversation with Claude that feels less like querying a search engine and more like pair programming with someone who never gets tired of your questions. You can ask follow-ups, request code changes, or ask it to explain something you inherited from a previous developer.
Sound familiar? You’re already in your IDE context, so there’s no context-switching to a browser or separate app.
Targeted Commands with File Paths
Want Claude to focus on something specific? Pass file paths directly — `claude read src/main/java/AuthService.java` opens that file for analysis without you needing to copy-paste anything. This is where things get practical: you can combine this with commands like `claude /review src/main/java/AuthService.java` to get a focused code review, or `claude /explain
Here’s a workflow I’ve found useful: `claude write test –output src/test/AuthServiceTest.java` generates a test file and pipes it straight to disk. No copy-pasting required.
Forgot where you left off? The `–resume` flag picks up your previous conversation, which becomes surprisingly valuable when you’re returning to a project after a weekend break.
Context-Aware Development with Project Awareness
One thing that clicked for me: running `claude` from your project root means Claude already knows your structure — the modules, the dependencies, the naming conventions. It can suggest files to modify based on what it sees, or help you navigate a codebase you didn’t write. Think of it like having a teammate who’s already read the README.
That’s the real advantage here — you’re staying in IntelliJ while accessing AI capabilities that understand your project context.
Practical Use Cases for Java Development
I’ve been using Claude Code for a few weeks now, and honestly, the day I stopped treating it like a fancy autocomplete and started treating it like a pair programmer was the day things clicked. Let me walk you through where it’s actually saved me time — not the theoretical stuff, but the stuff I reach for every day.
Code Generation and Boilerplate
The repetitive stuff is where Claude Code shines brightest. When I need a Spring Boot controller, I don’t start from scratch anymore — I ask it to scaffold one with the right annotations and dependency injection. Same with repositories, configuration classes, or that annoying boilerplate for DTOs. For tests, the command is straightforward: `claude write tests for src/main/java/PaymentProcessor.java using JUnit 5` and it generates a solid starting point with meaningful assertions. It’s not perfect — I always tweak the edge cases — but it cuts the boring parts down to minutes instead of an hour.
Spring Boot projects have so much ceremony that automating the scaffolding feels like getting back time. Sound familiar?
Debugging and Error Explanation
Here’s where Claude Code replaced three browser tabs worth of Stack Overflow. Paste a stack trace directly into the prompt and ask it to explain what went wrong. I’ve found that it doesn’t just decode the exception — it identifies the likely root cause and sometimes catches issues the error message buries. One time it spotted a race condition in a thread-safe class that I would’ve spent hours hunting otherwise.
Code Review Workflows
Running `claude /review` on a diff has become part of my pull request checklist. It catches things I gloss over when I’ve been staring at code too long — naming inconsistencies, potential null pointer issues, spots where a design pattern might improve things. When I’m architecting a new service layer, I’ll sometimes ask `claude suggest patterns for this service layer` with some context about the domain, and the recommendations are surprisingly grounded in real tradeoffs rather than textbook answers.
Documentation Generation
Documentation’s the first thing to go when deadlines hit, but Claude Code makes it almost painless. `claude document this class with Javadoc format` generates the skeleton, and then I just fill in the “why” that only I know. For existing methods, `claude suggest improvements for this method considering performance` has helped me catch unnecessary object allocations and inefficient loops before they become problems.
These use cases aren’t revolutionary — they’re just the boring, everyday tasks that add up.
Advanced Configuration: External Tools and Shortcuts
Once you’ve got Claude running in your terminal, you can integrate it even deeper into your workflow. These configurations aren’t strictly necessary, but I’ve found they shave off meaningful friction once you’re using Claude daily.
Creating IntelliJ External Tools
The most powerful setup is adding Claude directly into IntelliJ’s External Tools menu. Head to Settings → Tools → External Tools, then create a new tool with the program set to `claude` and arguments like `/review $FilePath$`. This lets you right-click any file and send it to Claude for review without touching the terminal at all.
What surprised me here was how flexible the argument syntax is. You can pass the current selection, the entire project directory, or just a single file — depending on what you’re trying to accomplish.
Keymap Shortcuts for Quick Access
External tools are great, but digging through menus defeats the purpose. Assign a keyboard shortcut by going to Settings → Keymap and searching for your tool’s name. I mapped mine to Ctrl+Shift+C, which keeps it muscle-memory adjacent to other common operations.
Sound familiar? If you’ve customized shortcuts before, you know the trick: avoid conflicts with existing shortcuts, and pick something that doesn’t require finger gymnastics.
Custom Scripts for Repeated Tasks
Two more tweaks worth considering. First, add a shell alias in your `.zshrc` — something like `alias cc=’claude’` — for faster typing during terminal sessions.
Second, leverage the project-specific `.claude/commands` directory for reusable prompt templates. Drop a file there with a descriptive name, and Claude can execute it with a simple reference. Combined with a `.claude.json` for default behavior, you’ve essentially built a personalized AI assistant tuned to your codebase.
These layers take maybe 15 minutes to set up, but they make Claude feel less like an external tool and more like a native part of your IDE.
Troubleshooting Common Integration Issues
Even with a clean install, you might hit a few snags when wiring Claude Code into IntelliJ. Here’s where most people get stuck — and how to fix it fast.
Authentication Problems
The most common issue I see is API key errors that feel mysterious until you realize what’s happening: IntelliJ’s terminal doesn’t always inherit your shell’s environment variables automatically. If you run `claude` and get an authentication error, check that `ANTHROPIC_API_KEY` is actually set in the same shell IntelliJ launches.
On macOS with zsh, there’s a sneaky gotcha: if IntelliJ opens before your `.zshrc` finishes loading environment variables, you’ll get key errors even though your terminal works fine in Finder-launched shells. The fix? Either export the key in a shell configuration file that loads early, or start IntelliJ from a terminal that’s already authenticated.
Terminal Recognition Issues
When Claude “isn’t found” even after installation, it’s almost always a PATH issue. Your npm global bin directory needs to be in your PATH — run `npm bin -g` to find where npm installs global tools, then verify that path appears in your shell’s PATH variable. If you’re unsure, you can always use the full path to the executable as a workaround while debugging.
Here’s the part most tutorials skip: IntelliJ’s embedded terminal doesn’t always reload PATH changes made after the IDE starts. If you’ve installed Claude Code and your terminal still can’t find it, try restarting IntelliJ entirely. Or, from inside the terminal, run `exec $SHELL` to force a shell refresh — it’s like asking the terminal to check the environment again.
API Rate Limits and Costs
Your rate limits depend entirely on your Anthropic plan — the free tier has stricter limits than paid plans, and you’ll notice throttling if you’re hammering the API during a big refactoring session. Keep an eye on your usage at console.anthropic.com; it’s easy to burn through your quota without realizing it.
One thing that catches people: token limits. Claude’s context window has a maximum, and large files or long conversations can push you over. When you hit that ceiling, you’ll get errors explaining the limit — the fix is to break conversations into smaller pieces or exclude verbose files from your context.
Frequently Asked Questions
How do I install Claude Code in IntelliJ IDEA
First, install Claude Code globally via npm using ‘npm install -g @anthropic-ai/claude-code’, then restart your terminal in IntelliJ. In IntelliJ, go to Settings > Terminal and ensure your shell path points to your terminal app (bash/zsh). Restart IntelliJ, open the terminal, and type ‘claude –version’ to verify. If you get a path error, you may need to add npm’s global bin directory to your PATH in .zshrc or .bash_profile.
Can I use Claude Code directly inside JetBrains IDE without leaving the editor
Yes, and this is where Claude Code really shines for JetBrains users. Open IntelliJ’s built-in terminal (Alt+F12), and Claude Code runs natively in that shell. You get full AI assistance while staying in your IDE context—no tab switching required. I’ve used this extensively when refactoring Spring Boot services; I keep my editor on one monitor and Claude’s terminal output on another, which feels more natural than floating chat panels.
What’s the difference between using Claude Code CLI vs GitHub Copilot in IntelliJ
The core difference is architecture: Copilot is a JetBrains plugin with inline autocomplete and ghost text, while Claude Code is a terminal-first tool that generates code through conversational prompts. In practice, Copilot excels at real-time completion (type a method signature and suggestions appear), but Claude Code handles complex multi-file refactoring, architecture discussions, and code explanation better. A practical example: I used Claude Code to generate an entire repository layer structure with DTOs and mappers in one session—Copilot would have required 50+ individual completions to match that scope.
How do I fix ‘claude command not found’ in IntelliJ terminal
This usually means npm’s global bin directory isn’t in your shell PATH. Run ‘npm config get prefix’ to find where npm installs global packages, then add that path (usually ~/.npm-global/bin or /usr/local/bin) to your PATH in your shellrc file. After saving, run ‘source ~/.zshrc’ or restart your terminal. If you’re on macOS with Apple Silicon, check that Node.js is installed for your architecture—I’ve seen this fail silently on M-series chips when using Rosetta-installed Node.
What are the best prompts for using Claude Code for Java Spring Boot development
For Spring Boot specifically, I get best results with context-rich prompts like ‘Explain the dependency injection flow in this @Service class’ or ‘Refactor this repository to use Spring Data JPA specifications’. When working with REST controllers, try ‘Generate unit tests for this endpoint using MockMvc and given-when-then syntax’. For architecture questions, I’ve had great success with ‘Compare @Component vs @Bean usage in this configuration class with pros and cons’. The key is including file paths or pasting relevant code—Claude Code in the terminal doesn’t have Copilot’s context awareness, so explicit references get much better output.
📚 Related Articles
If you’re switching between IntelliJ and a separate terminal window, try moving everything into the IDE terminal today—it takes five minutes and the context awareness alone makes the setup worth it.
Subscribe to Fix AI Tools for weekly AI & tech insights.
Onur
AI Content Strategist & Tech Writer
Covers AI, machine learning, and enterprise technology trends.