java在vscode中的常用json配置
时间: 2024-02-13 15:03:49 浏览: 22
以下是在 VS Code 中使用 Java 时常用的 JSON 配置:
1. `settings.json` 文件配置:
```json
"java.home": "/path/to/java/home", // 指定 Java 安装路径
"java.errors.incompleteClasspathSeverity": "ignore", // 忽略项目中的不完整类路径
"java.configuration.checkProjectSettingsExclusions": false // 禁用项目设置排除项的检查
```
2. `launch.json` 文件配置:
```json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "Launch App",
"request": "launch",
"mainClass": "com.example.MyApp",
"args": ["arg1", "arg2"]
}
]
}
```
3. `tasks.json` 文件配置:
```json
{
"version": "2.0.0",
"tasks": [
{
"type": "java",
"label": "Compile",
"command": "javac",
"args": ["-d", "${workspaceFolder}/bin", "${file}"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "java",
"label": "Run",
"command": "java",
"args": ["-classpath", "${workspaceFolder}/bin", "com.example.MyApp"],
"group": "test"
}
]
}
```
以上是一些常用的 Java 在 VS Code 中的 JSON 配置,可以根据自己的需求进行调整。