Error: plantuml.jar file not found: "" Please download plantuml.jar from https://plantuml.com/download. If you are using VSCode or coc.nvim, then please set the setting "markdown-preview-enhanced.plantumlJarPath" to the absolute path of plantuml.jar file. If you don't want to use plantuml.jar, then you can use the online plantuml server by setting the setting "markdown-preview-enhanced.plantumlServer" to the URL of the online plantuml server, for example: https://kroki.io/plantuml/svg/
时间: 2025-07-28 18:37:05 浏览: 11
在使用 PlantUML 时,如果遇到 `plantuml.jar file not found` 错误,通常是因为编辑器(如 VSCode 或 coc.nvim)无法找到 `plantuml.jar` 文件的路径,或者该文件未正确下载或配置。以下是一些解决此问题的方法:
### 1. 确认 PlantUML jar 文件的正确路径
确保 `plantuml.jar` 文件已经下载并放置在一个固定路径中。通常,该文件可以从 [PlantUML 官方网站](https://sourceforge.net/projects/plantuml/files/plantuml/) 下载。
下载后,将 `plantuml.jar` 文件放置在某个目录下,例如 `/usr/local/plantuml/plantuml.jar`。
### 2. 配置 VSCode 中的 PlantUML 路径
在 VSCode 中,可以通过设置 `plantuml.jar` 的路径来解决此问题。打开 VSCode 的设置(Settings),并添加以下配置:
```json
"plantuml.jar": "/usr/local/plantuml/plantuml.jar"
```
如果使用 `settings.json` 文件进行配置,可以添加如下内容:
```json
{
"plantuml.jar": "/usr/local/plantuml/plantuml.jar"
}
```
### 3. 使用 coc.nvim 配置 PlantUML
对于使用 `coc.nvim` 的用户,可以在 `coc-settings.json` 文件中配置 PlantUML 的路径:
```json
{
"plantuml.jarPath": "/usr/local/plantuml/plantuml.jar"
}
```
确保路径正确无误,并且文件确实存在于指定位置。
### 4. 自动下载 PlantUML jar 文件
如果尚未下载 `plantuml.jar`,可以通过以下命令自动下载并放置到指定路径:
```bash
mkdir -p /usr/local/plantuml
cd /usr/local/plantuml
wget https://sourceforge.net/projects/plantuml/files/plantuml/2023.10/plantuml.2023.10.jar/download -O plantuml.jar
```
### 5. 使用在线 PlantUML 服务
如果不想本地配置 `plantuml.jar`,可以选择使用在线服务。例如,PlantUML 提供了在线编辑器,可以直接在浏览器中使用。只需将 UML 图的代码粘贴到在线编辑器中,即可实时生成图表。
### 6. 检查文件权限
确保 `plantuml.jar` 文件具有正确的执行权限。可以使用以下命令修改权限:
```bash
chmod +x /usr/local/plantuml/plantuml.jar
```
### 7. 验证 Java 环境
PlantUML 依赖于 Java 环境运行。确保系统中已安装 Java,并且可以通过以下命令验证:
```bash
java -version
```
如果 Java 未安装,可以使用以下命令安装:
```bash
yum install java-1.8.0-openjdk
```
### 8. 使用脚本自动运行 PlantUML
如果需要频繁运行 PlantUML,可以编写一个简单的脚本来简化操作。例如:
```bash
#!/bin/bash
java -jar /usr/local/plantuml/plantuml.jar "$1"
```
保存为 `plantuml.sh` 并赋予执行权限:
```bash
chmod +x plantuml.sh
```
然后可以通过以下命令运行 PlantUML:
```bash
./plantuml.sh your_diagram.puml
```
---
阅读全文
相关推荐











