Visual Studio代码projectName [英] Visual Studio Code projectName

查看:185
本文介绍了Visual Studio代码projectName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VS Code进行Java调试时,必须在 launch.json 文件中定义projectName,以便在调试时使用监视窗口.

Using VS Code for Java debugging, there must be projectNamedefined 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?

我总是收到错误消息:

无法解析类路径:项目"??"不是有效的Java 项目.

Failed to resolve classpath: The project '??' is not a valid 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆