图文攻略 · 16 步全截图

Claude Code 在 JetBrains IDE 里的安装与配置(IntelliJ 图文攻略)

从 JetBrains Marketplace 插件到 IntelliJ IDEA 里能正常对话的 Claude Code 面板——装插件、装 CLI、修 Path、登录、发出第一条提示词,每一步都有真实会话截图。

JetBrains Marketplace search for claude code inside IntelliJ IDEA returning 220 results, with third-party lookalike plugins above the official Claude Code [Beta] entry published by Anthropic PBC
在 JetBrains Marketplace 搜索 Claude Code:只有 Anthropic PBC 发布的 Claude Code [Beta] 才是官方插件。

阅读约 6 分钟 · 16 步带图解

一句话结论

先在 IntelliJ 的 Marketplace 里安装 Anthropic PBC 的 Claude Code [Beta] 插件,但要清楚:插件只是终端入口,claude CLI 必须单独安装(Windows 用 irm https://claude.ai/install.ps1 | iex),再把安装位置加进 Path 环境变量并重启 IDEA。之后插件的终端会依次让你选主题、选登录方式、确认信任项目文件夹,然后就能输入提示词和 /model 这类斜杠命令了。

视频来源

本页 16 张截图全部来自 United Top Tech 的屏幕录像。视频用四分钟在 Windows 上完整走了一遍装插件、修 CLI、发出第一条提示词的流程——下面每一步都链回来源视频的对应秒数。

截图标注来源并回链原视频;文字讲解为本站原创。

第 1 部分 — 从 Marketplace 安装插件

Settings → Plugins → Marketplace,认准唯一靠谱的发布者。

  1. 1

    打开设置,进入 Plugins

    在 IntelliJ IDEA 顶部点开设置图标,选择 Plugins。视频还特别提醒先把 IDEA 升级到最新版。切到 Marketplace 标签页,在搜索框里输入 claude。

    IntelliJ IDEA Settings dialog open on the Plugins Marketplace tab with cla typed into the marketplace search box and JetBrains AI Assistant heading the Staff Picks list
    Settings 对话框,已选中 Plugins,Marketplace 搜索框正在输入。看视频 0:28
  2. 2

    只认 Anthropic PBC 那一条

    搜索会返回 220 条结果,其中大量是第三方发布的仿冒品——Claude Code with GUI、CC GUI、Claude Codex AiGo123 等等。视频给出的原则是:只信任 Anthropic PBC 发布的版本。官方插件叫 Claude Code [Beta],下载量 420 万。

    JetBrains Marketplace search results for claude code inside IntelliJ IDEA showing 220 hits with lookalike plugins from third-party publishers and the official Claude Code [Beta] by Anthropic PBC listed third with a 4.2M download count
    搜索结果里全是仿冒插件,真正的官方版本是 Anthropic PBC 的 Claude Code [Beta]。看视频 0:32
  3. 3

    看清详情页再点 Install

    详情页上写着发布者(Anthropic PBC)、版本(录屏里是 0.1.14-beta),还有一条容易被忽略的 IMPORTANT 提示:本插件需要单独安装 Claude Code。点 Install,Accept,再 Apply 和 OK。

    Claude Code [Beta] plugin detail page in IntelliJ IDEA showing publisher Anthropic PBC, version 0.1.14-beta, a green Install button and an IMPORTANT note that the plugin requires Claude Code to be installed separately
    Claude Code [Beta] 详情页——那条 IMPORTANT 提示正是下一部分要解决的问题。看视频 0:46

第 2 部分 — 光装插件不够:还要装 CLI

CLI 没装好之前,工具栏图标点了只会报错。

  1. 4

    找到新出现的工具栏图标

    安装完成后,IntelliJ 顶部工具栏会出现 Claude Code 的星形图标(快捷键 Ctrl+Escape),悬停即可看到提示。点一下就应该在 IDE 里打开 Claude Code 终端。

    Claude Code starburst icon hovered in the IntelliJ IDEA top toolbar with the tooltip Claude Code Ctrl+Escape showing next to it after the plugin install finishes
    Claude Code 图标落在顶部工具栏,带 Ctrl+Escape 快捷键。看视频 0:58
  2. 5

    首次启动大概率报错

    录屏里点开图标后,终端里输入 claude 直接报错:The term 'claude' is not recognized as the name of a cmdlet... 原因是插件只是调用 claude 命令行,而 CLI 还没安装。接下来就是为这一步补救。

    IntelliJ IDEA terminal tool window running Windows PowerShell where typing claude fails with the red error The term claude is not recognized as the name of a cmdlet and CommandNotFoundException below it
    Claude Code 终端标签里的 PowerShell:CommandNotFoundException,因为 CLI 缺失。看视频 1:03
  3. 6

    去官方文档拿安装命令

    打开 Claude Code 文档(code.claude.com/docs)找到安装方式。文档给出 Native Install(推荐)以及 Homebrew、WinGet,并分别为 macOS/Linux/WSL、Windows PowerShell 和 Windows CMD 提供命令。本次 Windows 会话复制的是 PowerShell 那行:irm https://claude.ai/install.ps1 | iex。

    Claude Code Docs getting started page listing install methods with Native Install recommended, showing curl for macOS Linux and WSL plus irm https://claude.ai/install.ps1 | iex under Windows PowerShell
    文档页列全了三种 Windows 安装命令,这里用的是 PowerShell 那条。看视频 1:16
  4. 7

    在 PowerShell 里运行安装脚本

    打开 PowerShell,粘贴命令并回车。安装器先打印 Setting up Claude Code...,再打印 Installing Claude Code native build latest...,稍等片刻即完成。下载过程录屏里被剪掉了,实际要等一会儿。

    Windows PowerShell window opened over the Claude Code docs running irm https://claude.ai/install.ps1 | iex with Setting up Claude Code and Installing Claude Code native build latest in the output
    PowerShell 窗口里原生安装器正在拉取 Claude Code。看视频 1:26

第 3 部分 — 把 claude 加进 Path

把安装位置写进环境变量,并验证生效。

  1. 8

    把安装位置加进 Path

    安装器会打印安装位置——录屏里是 C:\Users\kcprp\.local\bin\claude.exe。视频把它复制下来,在 Windows 搜索 edit system environment variables,在 Environment Variables 里编辑 Path,加上这个位置,然后一路 OK 退出。

    Windows Environment Variables dialog open over PowerShell showing Claude Code successfully installed with version 2.1.195 and location C:\Users\kcprp\.local\bin\claude.exe, with the user Path and system Path entries visible for editing
    Environment Variables 对话框叠在安装成功的输出上:版本 2.1.195,位置 .local\bin\claude.exe。看视频 1:44
  2. 9

    在命令行验证 claude 可用

    新开一个命令提示符,输入 claude。这次不再是报错,而是出现 Claude Code 吉祥物、Let's get started 和主题选择列表——说明 Path 修改生效了。关掉窗口,重启 IntelliJ IDEA 让它读到新环境变量。

    Windows Command Prompt running claude successfully after the Path fix, showing the Claude Code mascot, the message Lets get started, and the Choose the text style list with Dark mode selected above a red and green preview snippet
    命令提示符里运行 claude:吉祥物和主题列表说明 CLI 已经可用。看视频 1:56

第 4 部分 — 在 IntelliJ 里登录

选主题、选登录方式、确认信任文件夹。

  1. 10

    回到 IntelliJ,面板开始引导

    IDE 重启后点 Claude Code 图标,同样的引导流程出现在停靠的终端工具窗口里:Welcome to Claude Code v2.1.195,然后是 Choose the text style that looks best with your terminal。方向键加回车选择,以后可用 /theme 随时改。

    Claude Code tool window docked inside IntelliJ IDEA running the same onboarding, with Welcome to Claude Code v2.1.195 and a seven-option text style picker ranging from Auto match terminal to Light mode ANSI colors only
    IntelliJ 里的 Claude Code 工具窗口,七项主题选择停在 Dark mode。看视频 2:12
  2. 11

    选择登录方式

    接下来面板让你选择登录方式:1)Claude 订阅账号(Pro、Max、Team 或 Enterprise);2)Anthropic Console 账号,按 API 用量计费;3)第三方平台(Amazon Bedrock、Microsoft Foundry、Vertex AI)。回车后浏览器会打开并登录你的 Claude 账号。

    Claude Code onboarding inside IntelliJ IDEA asking to Select login method between a Claude account with subscription for Pro Max Team or Enterprise, an Anthropic Console account with API usage billing, and a 3rd-party platform like Amazon Bedrock
    三种登录方式:订阅、API 计费,或第三方平台。看视频 2:24
  3. 12

    信任项目文件夹

    登录完成后,Claude Code 会对 IntelliJ 当前打开的文件夹做一次安全确认——录屏里是 C:\Users\kcprp\IdeaProjects\Demo,并提示 Claude 将能读取、修改和执行这里的文件。自己的项目就选 1. Yes, I trust this folder。

    Claude Code panel in IntelliJ IDEA showing the Accessing workspace safety check for C:\Users\kcprp\IdeaProjects\Demo with a quick safety check message and the options 1. Yes, I trust this folder and 2. No, exit
    Demo 项目的 workspace 安全确认,通过后 Claude 才能访问。看视频 2:46

第 5 部分 — 第一批命令与第一条提示词

斜杠菜单、/model 换模型,让 Claude 讲解代码。

  1. 13

    输入 / 列出所有命令

    面板打完招呼(Welcome back Coder!)并给出提示(运行 /init 可以生成 CLAUDE.md)。在输入框敲 / 就会弹出带说明的命令菜单——和在终端里一样的斜杠命令,在 IntelliJ 里一键可达。

    Claude Code welcome screen inside IntelliJ IDEA reading Welcome back Coder with Opus 4.8 1M context and API Usage Billing, next to Tips for getting started and a slash command menu listing /export, /fast, /feedback, /focus and /fork
    欢迎横幅和斜杠菜单:/export、/fast、/feedback 一应俱全。看视频 3:20
  2. 14

    用 /model 切换模型

    运行 /model 打开模型选择器。录屏里列出的选项有 Default(推荐)Opus 4.8($5/$25 每百万 token)、Opus、Sonnet 4.6($3/$15)、Sonnet(1M 上下文)和 Haiku 4.5($1/$5),作者选了适合快速问答的 Haiku。选择会保存为新会话的默认值。

    Claude Code Select model menu in IntelliJ IDEA listing Default recommended Opus 4.8 at $5/$25 per Mtok, Sonnet 4.6 at $3/$15, Sonnet 1M context, and Haiku 4.5 at $1/$5 highlighted as the pick with a disabled Fable row below
    /model 选择器,Haiku 4.5 高亮,$1/$5 每百万 token。看视频 3:30
  3. 15

    让 Claude 解释代码

    Main.java 里的 for 循环还停在编辑器里,作者输入 explain the code。Claude 回复说需要知道看哪个文件,并给出选项:给一个文件路径(比如 src/main.js)或直接粘贴代码片段。这里回答的是 main.java。

    Claude Code panel in IntelliJ IDEA replying to the prompt explain the code by asking which file to look at, offering to take a file path like src/main.js or a pasted snippet, above the main.java file answer being submitted
    Claude 追问要解释哪个文件,输入框里填 main.java。看视频 3:52
  4. 16

    阅读逐行讲解

    一次快速搜索(Searched for 1 pattern, read 2 files)之后,Claude 逐行解释:第 6 行打印什么,循环如何把计数器初始化为 1、在 i 小于等于 5 时持续运行、每轮加一,以及运行时会输出的 i = 1 到 i = 5。至此 IntelliJ 里的完整闭环走通。

    Claude Code explanation inside IntelliJ IDEA covering line 6 of Main.java, a Lines 8-12 loop breakdown of counter initialization, the i is less than or equal to 5 condition and the increment, and the Output when run listing i = 1 through i = 5
    逐行讲解:循环三要素加程序输出。看视频 4:00

常见问题