问题描述
使用VS Code进行Java调试时,必须在 launch.json 文件中定义projectName
,以便在调试时使用监视窗口.
Using VS Code for Java debugging, there must be projectName
defined in the launch.json file for using the watch-window while debugging.
如何确定和/或定义Java项目的名称?
How to determine and/or define the name of the Java project?
我总是收到错误消息:
这是我的launch.json摘录:
Here my launch.json extract:
"type": "java",
"name": "Debug (Launch)-Application<foo>",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "FooClass",
"args": "",
"projectName": "??",
"windows": {
"classPaths": [
"%CLASSPATH%","C:\\JUnit\\junit-4.12.jar", "C:\\JUnit\\hamcrest-junit-2.0.0.0.jar", "."
]
}
推荐答案
对于Maven项目(至少),您可以在MAVEN PROJECTS下的vscode侧栏底部找到项目名称.
For Maven projects(at least) you can find the project names at the bottom of the vscode sidebar under MAVEN PROJECTS.
您还可以在项目内查找.project文件.projectName在name属性中.
You can also look for .project files inside your projects.The projectName is there in the name attribute.
*我根本不是专家,但是我也为此而苦苦挣扎,所以我希望它可以帮助其他人!
*I'm not expert on this at all, but I was struggling with this too, so I hope it can help someone else!
这篇关于Visual Studio代码projectName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!